J
Jania
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
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