开发者

Export Location Using Access Macro

I have an interesting question. I have an access database and there is a macro that exports certain queries to excel. That is working fine. 开发者_如何学GoHowever, this database is saved on a shared folder of a local network. If I wanted the macro to export the database to the documents folder or desktop folder of the user, how would I do this?

Also, kind of a side note - is it possible to attach some sort of vba code to open the exported document in excel as well?


You can use the environ function to get this kind of information. For example the users desktop can be found by calling this bit of code

Environ("userprofile") & "\Desktop"

For opening the file after you could use this bit of code that opens up a file using the default application for that extension

Application.FollowHyperlink “C:\Your_excel_sheet.xls”

That should set you in the right direction

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜