![]() |
#1
|
|||
|
|||
![]()
Hi,
I am trying to make a macro that exports the current sheet as a PDF as 'invoice [cell value].pdf. I keep trying different things and am getting this error: Run-time error '1004': Document not saved. The document may be open, or an error may have been encountered when saving. This is my macro: Sub Savei() ActiveSheet.ExportAsFixedFormat _ Type:=xlTypePDF, _ Filename:="C:\invoice" & Range("G3") & ".pdf", _ Quality:=xlQualityStandard, _ IncludeDocProperties:=True, _ OpenAfterPublish:=True End Sub Thanks in advance ![]() |
#2
|
||||
|
||||
![]()
Are you sure all the characters in G3 are valid for a filename and that you don't already have a file with that name in the destination folder open? I also note you're trying to save directly to the "C:\" folder (the way you have it coded, "Invoice" is part of the filename). Usually that's not allowed. If you're trying to save to the "C:\Invoice" folder, you need to use "C:\Invoice\".
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
Tags |
macro, pdf, save |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Document which always ask to be saved on access? | quirky | Word | 2 | 12-15-2012 11:32 AM |
![]() |
yonasan | Excel Programming | 3 | 06-12-2012 11:08 PM |
![]() |
gbaker | Excel Programming | 11 | 06-06-2012 05:23 AM |
![]() |
Jamal NUMAN | Word | 1 | 04-14-2011 04:27 AM |
Word: The document 'Filename' caused a serious error the last time ... | martincruise | Word | 0 | 02-25-2010 01:47 AM |