简体   繁体   English

在导出访问 vba 上打开一个 excel 文件

[英]open an excel file on export access vba

Set wbTarget1 = xl.Workbooks.Open("C:\\Users\\Owner\\Dropbox\\Trk_Insp_1204_10_08_2016.xlsx") Set wbTarget1 = xl.Workbooks.Open("C:\\Users\\Owner\\Dropbox\\Trk_Insp_1204_10_08_2016.xlsx")

The location is different on the other machines, ie the owner is different.其他机器上的位置不同,即所有者不同。 Can I use current.path?我可以使用 current.path 吗? Can I use wild cards or我可以使用通配符或

~\\Trk_Insp_1204_10_08_2016.xlsx ~\\Trk_Insp_1204_10_08_2016.xlsx

I saw a reference that mentioned you can truncate the path if the excel file resided in the current directory the access DB was located.我看到一个参考资料,提到如果 excel 文件位于访问数据库所在的当前目录中,您可以截断路径。

Dennis丹尼斯

Please make a simple test sub and test:请做一个简单的测试子并测试:

Sub EnvTest()
 Dim S as String

 S = Environ("USERPROFILE") & "\Dropbox\Trk_Insp_1204_10_08_2016.xlsx"
 Debug.Print S
End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM