Save as PDF from cell "a1"

MESHACK

New Member
Joined
Feb 1, 2012
Messages
19
Code:
'Save to PDF


    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:= _
        "C:\Users\HP\Desktop\MC SIGN\[B][COLOR=#ff0000]324916-01 Invoice[/COLOR][/B].pdf" _
        , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
        :=False, OpenAfterPublish:=True
    
    
End Sub

This Macro works but always saves to:324916-01 Invoice. I would like it to save to whatever text is in cell "A1"
Any help would be greatly appreciative.
Thank you in advance.
 

Some videos you may like

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Snakehips

Well-known Member
Joined
May 17, 2009
Messages
5,059
Office Version
  1. 2013
Platform
  1. Windows
MESHACK,
Try.........

"C:\Users\HP\Desktop\MC SIGN\" & Range("A1") & ".pdf"

Which should be fine provided that A1 does not contain any characters that are invalid within a filename.

Hope that helps.
 

bbott

Well-known Member
Joined
Feb 5, 2010
Messages
2,350
Code:
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "C:\Users\HP\Desktop\MC SIGN\[B][COLOR=#ff0000]" & range("A1") & "[/COLOR][/B].pdf" _
        , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
        :=False, OpenAfterPublish:=True
 

Watch MrExcel Video

Forum statistics

Threads
1,109,205
Messages
5,527,402
Members
409,760
Latest member
zeeshansyed

This Week's Hot Topics

Top