LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default save excel 2007 worksheet as pdf in macro

Hi,

I have recorded a macro in excel 2007 (with the Acrobat tab) to save an
excel sheet as a pdf. I can get the macro to make the pdf but it will not
save it. This is the code i have recorded:

Sub Macro1()
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"R:\Actuarial Data\Form Filing Project\formfilingschvol2..pdf",
Quality:= _
xlQualityStandard, IncludeDocProperties:=True,
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End Sub

I changed it to this.

Sub pdf()
' creates a pdf of an excel worksheet
Dim stateint As String, shname As String, lob As String
stateint = Range("ca1").Value
shname = Range("ca4").Value
lob = Range("ca2").Value
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"R:\Actuarial Data\" & lob & "\Filings\2008\" & stateint & "\" &
shname & ".pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=True,
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End Sub

When I run either one I get the error message: Run-time error '1004'.
Document not saved. The document may be open, or an error may have been
encountered when saving. If anyone has any suggestions as to how I can fix
this it would be appreciated. Thanks
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
save a worksheet as template in excel 2007 DTP941 Excel Discussion (Misc queries) 3 October 21st 09 05:12 PM
Save as file format excel worksheet 4.0 in Microsoft excel 2007 Saria Excel Discussion (Misc queries) 1 July 14th 08 11:39 AM
How can I save a macro to an excel 2007 woorkbook help Excel Programming 1 December 6th 07 01:27 AM
save single excel worksheet out of workbook in excel 2007 rokbroscore Excel Discussion (Misc queries) 2 July 13th 07 09:43 PM
How do I set up a macro to save an Excel worksheet as a .prn file? cher Excel Programming 2 March 1st 06 03:50 PM


All times are GMT +1. The time now is 12:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"