MSAccess How to prompt in export to Excel VBA statement

Capricorn1 gave me the answer for VBA code to export a query to Excel.  Now I'd like to know how to make that query prompt for file name rather than hard-coded as in his answer: DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, _
"queryName", "C:\myQuery.xls", True, ""
Greg989Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:


you can use a value typed in a textbox

if len(Me.textboxName & "")>0 then

       DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, _
"queryName", Me.textboxName, True, ""
      else
         msgbox "please enter full path"
          exit sub
         me.textboxname.setfocus    
end if
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Greg989Author Commented:
That is helpful for future reference but what I'd really like to emulate is what happens when you run an OutputTo macro where the file name is left blank.  In that case you are presented the windows "Save As" dialogue screen defaulting to MyDocuments.
0
Rey Obrero (Capricorn1)Commented:
0
Greg989Author Commented:
Thanks... It appears this will work.  Regardless, it most likely will serve me well for future reference.  Since it is fairly complex, relative to my puny mind, I think I'll just "RunMacro" instead and leave the file name blank as mentioned in my original question.  Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.