Issue with exporting to PDF

ardykav

Board Regular
Joined
Oct 18, 2015
Messages
172
Office Version
  1. 365
Platform
  1. Windows
I have had some code which has always worked fine. However now it keeps erroring for some reason, I have highlighted where the script is erroring. I am simply trying to export the sheet to a pdf.

The value in S2 was previously this
="AdminList "&TEXT(Controls!$B$2,"MMMM DD YYYY ")&TEXT(List!$M2,"h.mmAM/PM")

But i thought it was an error with that so I just changed it to text so it read "Admin List 1", this worked the first time that I ran it but after that it errored out again. I also have an admin list 2,3 and 4 and another bit of code that merges them and all have worked fine up until this point.
Admin List 1

I am guessing the error is with the file name but any help would be appreciated. I would prefer to have the formula as the file name but am flexible with what works


VBA Code:
Sub admissionsource1()

Dim FolderPath As String

       
    Sheets("Adm SStats 1").Select
    [B]ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Range("S2").Value, _
        openafterpublish:=False, ignoreprintareas:=False[/B]
    Sheets("Adm SStats 1").Select
    Range("A1").Select
    

End Sub
 
Sorry, I missed mentioning that it is only for a test and discard the date and time format ?
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,223,275
Messages
6,171,126
Members
452,381
Latest member
Nova88

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