filename issue

Trevor3007

Well-known Member
Joined
Jan 26, 2017
Messages
675
Office Version
  1. 365
Platform
  1. Windows
hi ,

i currently use the following code:-

Code:
Sub PrntEU()'
' PrntEU Macro
' print as PDF TimeSheet & EXP
'


'
    Range("A1:J22").Select
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "C:\UsersTimesheets\To Be Approved\TSheet WC 11-02-2019.pdf" _
        , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
        :=False, OpenAfterPublish:=False
    Sheets("Expenses-Reimburse").Select
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "C:\Users\Timesheets\To Be Approved\Exp WC 11-02-2019.pdf" _
        , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
        :=False, OpenAfterPublish:=False
    Sheets(TSheet WC 11-02-2019").Select
    Range("F15").Select
End Sub

all is good until I run it with new file name , how can i solve this please?

KR
Trevor3007
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
hi ,
how can i solve this please?
Trevor3007

Start by providing a detailed description of the problems you are having. Be specific, "It gives me an error" is not specific, while "I get a Run-Time error 1004 'Document not saved' at the ExportAsFixedFormat line" is highly specific. Lastly tell us what end result you are attempting to achieve.
 
Upvote 0
Start by providing a detailed description of the problems you are having. Be specific, "It gives me an error" is not specific, while "I get a Run-Time error 1004 'Document not saved' at the ExportAsFixedFormat line" is highly specific. Lastly tell us what end result you are attempting to achieve.

Good morning rlv01
thank you for your reply.

I ran the workbook & it worked OK!!!!!

MTA for your help. But all good so far.

Have a great day.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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