Public Sub InputData(var)
Dim WB As Workbook
Dim FilePath As String
FilePath = "C:\Users\Jordan.Jennings\Desktop\Programs{}\Test.xlsx"
WB = Workbooks.Open(FilePath)
ibox = 1
E = 8.5
N = 10
W = 7.5
S = 9.75
Do Until ibox = var
Set I = ActivePage.DrawRectangle(E, N, W, S)
I.Text = WB.Worksheets("Sheet1").Range("A1").Value
N = N - 0.25
S = S - 0.25
ibox = ibox + 1
Loop
End Sub
好吧,我已经尝试了很多事情-我想做的是在visio中用Excel文档中的文本绘制一堆盒子,当我执行worksheets(“ Sheet1”)时。范围不出现一个选项,我抛出错误91请帮助我在这里茫然
答案 0 :(得分:1)
WB
是Workbook
对象引用。
WB = Workbooks.Open(FilePath)
您不能分配这样的对象引用。
Set WB = Workbooks.Open(FilePath)
那应该解决它。