Export As Fixed Format second code not working

mtagliaferri

Board Regular
Joined
Oct 27, 2004
Messages
156
Hi Have a code to create a pdf file and open it afterwards, this works perfect, however I have added a second sheet which I want to save and open this sheet too (Company Property Checklist), but since adding this I have an error

VBA Code:
Sub CreatePDF()
    ShLeaversForm.ExportAsFixedFormat xlTypePDF, Environ("Userprofile") & "\Documents\" & Range("D12") & " " & Range("D13") & " " & _
        Format(Range("E19"), "YYYYDDMM") & " " & ShLeaversForm.Name & ".pdf", OpenAfterPublish:=True
    ShCompanyPropertyChecklist.ExportAsFixedFormat xlTypePDF, Environ("Userprofile") & "\Documents\" & Range("D12") & " " & Range("D13") & " " & _
    Format(Range("E19"), "YYYYDDMM") & " " & ShLeaversForm.Name & ".pdf", OpenAfterPublish:=True
End Sub

Any thoughts on hoe to save both sheets separately and open them also?
 

Attachments

  • Capture.JPG
    Capture.JPG
    60.1 KB · Views: 6

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
I guess that's because you're trying to make a second file with exactly the same name as the first file.
 
Upvote 0
You are trying to save both pdfs with the same name. should the 2nd code not be using
VBA Code:
ShCompanyPropertyChecklist.Name
 
Upvote 0
Solution
o_O I starred to that code for so long to figure out where the error was thinking I had referenced to the correct sheet everywhere...Thanks for the fresh eyes there :)
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,006
Messages
6,122,665
Members
449,091
Latest member
peppernaut

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