下面是我的但出现错误
编译错误:预计语句结束。
Set galreqws = Workbooks.Open FileName:=ThisWorkbook.Path & "\galreq.xlsx"
答案 0 :(得分:1)
如果您要将var设置为Workbooks.Open方法的结果,请在参数中加上括号。
dim galreqws as workbook 'could also be dim galreqws as object
Set galreqws = Workbooks.Open(FileName:=ThisWorkbook.Path & "\galreq.xlsx")
'alternate
with Workbooks.Open(FileName:=ThisWorkbook.Path & "\galreq.xlsx")
debug.print .name
debug.print .fullname
debug.print .worksheets(1).name
'work with galreq.xlsx here
end with
如果您未设置对象var,则将括号排除在外。
Workbooks.Open FileName:=ThisWorkbook.Path & "\galreq.xlsx"
答案 1 :(得分:0)
此后没有 空格 :
gnome-keyring-daemon --unlock
基本上替换:
Sub qwerty()
Workbooks.Open Filename:=ThisWorkbook.Path & "\qwerty.xlsm"
Set galreqws = ActiveWorkbook
End Sub
具有:
This workbook.Path
(我使用两行代码来避免混淆自己)