You'll have to excuse me, I'm not a Microsoft programmer, (I just play one on TV).... so please correct me if I have some funky code that doesn't make sense to you seasoned vets.
I've got a button that I want to save a query as an excel doc and then launch excel with that doc open. I found a reference to a FAQ containing a fHandleFile function, and it works well. My struggle is finding a generic way to reference the user's My Documents folder. I am using Access 97 and have a mixture of XP and 98 desktops. Here is the code I have so far and it works, but please let me know if there is a better way of launching excel! But my main question is how do I reference the My Documents folder. I will change the c:\temp\... to this reference. Thank you!
I've got a button that I want to save a query as an excel doc and then launch excel with that doc open. I found a reference to a FAQ containing a fHandleFile function, and it works well. My struggle is finding a generic way to reference the user's My Documents folder. I am using Access 97 and have a mixture of XP and 98 desktops. Here is the code I have so far and it works, but please let me know if there is a better way of launching excel! But my main question is how do I reference the My Documents folder. I will change the c:\temp\... to this reference. Thank you!
Code:
DoCmd.OutputTo acOutputQuery, "qryMyProviders", acFormatXLS, "c:\temp\MyProviders.xls"
Dim var
var = modHandleFile.fHandleFile("C:\TEMP\MyProviders.xls", WIN_NORMAL)