Saved Export Question

Huey462

Board Regular
Joined
Jul 25, 2011
Messages
147
I have a saved export that should save a PDF of the current report to the user’s desktop…”should” being the key word. Currently I'm getting a "Run Time Error 2302-Microsoft Office Access can't save teh output data to the file you've selected". I can’t seem to figure out what the issue is, so any assistance would be greatly appreciated.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
When the file is opened the path to the user’s desktop is saved to a global variable with the code below:
<o:p> </o:p>
Code:
UserSavePath = Environ("USERPROFILE") + "\Desktop"
<o:p> </o:p>

Once the report is opened and the button is pressed, the following code is run:
<o:p> </o:p>
Code:
Private Sub PDFExportButton_Click()
    DoCmd.RunSavedImportExport ("AF2005Export")
    MsgBox ("Successfully exported to " & UserSavePath & "\2005-Armament.xlsx!"), vbInformation, "!!!! SUCCESS !!!!"
End Sub
<o:p> </o:p>
As you can tell by the code the import/export is called AF2005Export and the path/directory saved in the saved export list is “UserSavePath\AF2005-Armament.pdf”
<o:p> </o:p>
I’m sure there is a relatively simple fix for this, but I’m not seeing it.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Does it make a difference if you change the + to & in this line...
Code:
UserSavePath = Environ("USERPROFILE") + "\Desktop"

Denis
 
Upvote 0
No,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p></o:p>
It doesn't make any difference switching from a "+" to "&". Now that I've had some sleep I think the issue lies with using a variable in the saved export instead of a “normal C:\” path<o:p></o:p>
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top