Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-19-2014, 08:53 AM
doctor_who12 doctor_who12 is offline Run-time error '1004': Document not saved. The document may be open... Windows 8 Run-time error '1004': Document not saved. The document may be open... Office 2013
Novice
Run-time error '1004': Document not saved. The document may be open...
 
Join Date: Jan 2014
Posts: 1
doctor_who12 is on a distinguished road
Default Run-time error '1004': Document not saved. The document may be open...

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.
Reply With Quote
  #2  
Old 01-22-2014, 04:47 PM
macropod's Avatar
macropod macropod is offline Run-time error '1004': Document not saved. The document may be open... Windows 7 32bit Run-time error '1004': Document not saved. The document may be open... Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,932
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
Reply

Tags
macro, pdf, save

Thread Tools
Display Modes


Similar Threads
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
Run-time error '1004': Document not saved. The document may be open... Run time error 1004 yonasan Excel Programming 3 06-12-2012 11:08 PM
Run-time error '1004': Document not saved. The document may be open... runtime error 1004 gbaker Excel Programming 11 06-06-2012 05:23 AM
Run-time error '1004': Document not saved. The document may be open... Why Word goes to the first page each time we open the document? 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

Other Forums: Access Forums

All times are GMT -7. The time now is 12:52 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2023 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft