excel中vba编程range的应用
其中这句arg="'"&path&"["&file&"]"&sheet&"'!"&Range(ref).Range("A1").Address(,,xlR1C1)为什么要...
其中这句
arg = "'" & path & "[" & file & "]" & sheet & "'!" & Range(ref).Range("A1").Address(, , xlR1C1)
为什么要用两个range呢,谢谢
Private Function GetValue(path, file, sheet, ref)
' 从关闭的工作薄返回值
Dim arg As String
'确定文件是否存在
If Right(path, 1) <> "" Then path = path & ""
If Dir(path & file) = "" Then
GetValue = "File Not Found"
Exit Function
End If
'创建公式
arg = "'" & path & "[" & file & "]" & sheet & "'!" & Range(ref).Range("A1").Address(, , xlR1C1)
'执行EXCEL4宏函数
GetValue = Application.ExecuteExcel4Macro(arg)
End Function 展开
arg = "'" & path & "[" & file & "]" & sheet & "'!" & Range(ref).Range("A1").Address(, , xlR1C1)
为什么要用两个range呢,谢谢
Private Function GetValue(path, file, sheet, ref)
' 从关闭的工作薄返回值
Dim arg As String
'确定文件是否存在
If Right(path, 1) <> "" Then path = path & ""
If Dir(path & file) = "" Then
GetValue = "File Not Found"
Exit Function
End If
'创建公式
arg = "'" & path & "[" & file & "]" & sheet & "'!" & Range(ref).Range("A1").Address(, , xlR1C1)
'执行EXCEL4宏函数
GetValue = Application.ExecuteExcel4Macro(arg)
End Function 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询