我有一个VBA代码,该代码可以从excel工作表复制单元格数据并将其粘贴到powerpoint中,但是我无法像A2,B2,C2,D2一样按列方式将单元格增加到U2,而我是VBA的新手,人们请对此代码进行排序
我想增加像元,但for循环后范围没有变化,请仔细调查
Dim xlApp As Object
Dim xlWorkBook As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = False
Set xlWorkBook = xlApp.Workbooks.Open("C:\Users\point.xls",True,False)
SheetName = activesheet.Name
Set xlApp = Nothing
Set xlWorkBook = Nothing
Dim abc As String
'Dim SheetName As String
Dim TestRange As Range
Dim TestSheet As Worksheet
Dim PasteRange As Boolean
Dim RangePasteType As String
Dim RangeName As String
Dim AddSlidesToEnd As Boolean
Dim shts As Worksheet
Dim sld As Slide
Dim grpItem As Shape
Dim shp As Shape
Dim i As Long
Dim j As Long
Dim a() As Variant
i = 0
ReDim a(5)
a(0) = "VNL"
a(1) = "ABHI"
a(2) = "ABI"
a(2) = "RM"
'cell number used
'PasteRange = True
'RangeName = ("B3:B3")
'RangePasteType = "HTML"
'RangeLink = True
AddSlidesToEnd = True
On Error Resume Next
Set ppApp = GetObject(,"PowerPoint.Application")
On Error GoTo 0
'Set xlApp = CreateObject("Excel.Application")
'Make the instance visible
'ppApp.Visible = True
For Each sld In activePresentation.Slides
For Each shp In sld.Shapes
For Each c In Range("A2:A2")
If shp.HasTextFrame Then
If shp.TextFrame.HasText Then
abc = c
For i = 0 To 3
shp.TextFrame.textrange.Text = replace(shp.TextFrame.textrange.Text,a(i),abc)
Next
End If
End If
Next c
Next shp
Next
End Sub ```