Selecting File location for automatic save NOT WORKING

oliviar

Board Regular
Joined
Sep 12, 2010
Messages
184
Hi Guys,
This WAS working, and IS working in some of my workbooks, but not in the version I actually want to use >:|.
I can't work out what I've done wrong, as I am just copying and pasting the code over from the one where it works to the one where it doesn't. It prints as a PDF, it just doesn't go to the directory specified.:confused:

Code:
Sub printtopdf()
'
' Print to pdf AND save to the server in the everyone/olivia drive
'
    ChDir "z:\Everyone\Olivia\saved"
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
        Range("a1") & ".pdf", Quality:= _
        xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
        
        box = MsgBox("This message means the quote has been printed as a PDF and saved to the server.", vbOKOnly, "Saved to server")
End Sub
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi oliviar,
Your code works for me. I'm using Office 2007 if that helps? Is the version you are using different?
 
Upvote 0
Hi alan,
The problem seems to be when it's opened on other computers. When I'm on MY computer, it'll save to the S: drive (server) but when I send it to any of my colleagues, it saves the pdf to their desktop.

I'm totally stumped. :confused:

Do I need more forceful code?

I have tried both ChDrive and ChDir commands (I dont' know what distinguishes them) but the same problem occurs in both:
Code:
    ChDrive "S:\Everyone\saved\"
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
        Range("g6") & ".pdf", Quality:= _
        xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
and

Code:
  ChDir "S:\Everyone\saved\"
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
        Range("g6") & ".pdf", Quality:= _
        xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
 
Upvote 0
i have just finished writing an excel userform to pdf and email as attachment project myself. you will need an auxilliary program to help with this.
 
Upvote 0
One likely cause is that not all users have the same mapped drive letters..

I find it best to use the network path instead of mapped drive letters.

ChDrive "\\Sharename\Folder\Everyone\saved\"
Something like

Except that you can't changgDrive to that..

But, you should be able to include the path in the filename, will work the same.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,543
Messages
6,120,123
Members
448,947
Latest member
test111

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