Reputation: 139
I had code in Excel VBA that I want to convert to run in Powerpoint VBA as well. here is what I have so far in ppt VBA:
Dim wbkISS As Excel.Workbook
Dim varSheetISS As Excel.Worksheet
Set wbkISS = Workbooks.Open(FileName:="C:\Users\...\Documents\ISS.xlsm")
Set varSheetISS = wbkISS.Worksheets("For ISS")
strIDRangeISS = "A2:D50"
varSheetISS = varSheetISS.Range(strIDRangeISS)
For iRowISS = LBound(varSheetISS, 1) To UBound(varSheetISS, 1)
...
For iRowFCST = LBound(varSheetFCST, 1) To UBound(varSheetFCST, 1)
...
But at "LBound(varsheetISS" it gives me the Compile error: Expected Array. My code works fine in Excel so I'm thinking I have the wrong syntax for ppt?
Upvotes: 0
Views: 205
Reputation: 3324
Had to post as answer:
This code suffers from no 'Option Explicit' Header.
The variable varSheetISS
is being passed around recklessly.
It start life life as a worksheet, then is cast to a range(where the intention was to get the Range's Value).
A lot of this can be avoided by using Option Explicit.
Dim issArray As Variant: issArray = varSheetISS.Range(strIDRangeISS).Value2
Upvotes: 1