Convert active excel wksht to pdf file
Solved/Closed
Related:
- Xlqualitystandard
- Save as pdf office 2007 - Download - Other
- Excel to pdf converter free download - Download - PDF
- Convert number to words in excel - Guide
- Convert pdf to jpg windows - Guide
- How to open .ps file - Guide
2 responses
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
12 Mar 2010 à 04:38
12 Mar 2010 à 04:38
If you record your action, it will give you a macro template. Then you can modify it to suit your needs
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
12 Mar 2010 à 10:14
12 Mar 2010 à 10:14
I guess you are saying that you want user to enter a name for pdf file that you would use then in the code.
Dim fileName As String
fileName = ""
Do While (fileName = "")
fileName = InputBox("Save file as..", "Enter File name", "book1")
fileName = Trim(fileName)
Loop
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
fileName:="C:\Desktop\" & fileName & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
>
onedog
12 Mar 2010 à 13:47
12 Mar 2010 à 13:47
Good luck. Post your result back so that it may help some one else down the road.
Your suggestion isn't working as I get a debug error and when I go back into vb the following is highlighted in yellow:
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
fileName:="C:\Desktop\" & fileName & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
The following is the entire routine in the macro:
Dim fileName As String
fileName = ""
Do While (fileName = "")
fileName = InputBox("Save file as..", "Enter File name", "book1")
fileName = Trim(fileName)
Loop
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
fileName:="C:\Desktop\" & fileName & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End Sub
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
fileName:="C:\Desktop\" & fileName & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
The following is the entire routine in the macro:
Dim fileName As String
fileName = ""
Do While (fileName = "")
fileName = InputBox("Save file as..", "Enter File name", "book1")
fileName = Trim(fileName)
Loop
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
fileName:="C:\Desktop\" & fileName & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End Sub
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
>
onedog
12 Mar 2010 à 14:28
12 Mar 2010 à 14:28
Could you possibly put the file at https://authentification.site or some other share site
Two things.
1. Do you have a folder C:\desktop, as that's where the file is being saved. Else you have to change that to point to right location
2. The full macro would have been
Two things.
1. Do you have a folder C:\desktop, as that's where the file is being saved. Else you have to change that to point to right location
2. The full macro would have been
Sub SaveSO()
Dim fileName As String
fileName = ""
Do While (fileName = "")
fileName = InputBox("Save file as..", "Enter File name", "book1")
fileName = Trim(fileName)
Loop
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
fileName:="C:\Desktop\" & fileName & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End Sub
onedog
>
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
12 Mar 2010 à 14:49
12 Mar 2010 à 14:49
I just uploaded my file.
12 Mar 2010 à 08:46
12 Mar 2010 à 08:57
12 Mar 2010 à 09:52
Sub SaveSO()
'
' SaveSO Macro
'
'
Range("B2:I50").Select
Range("I2").Activate
ChDir "C:\"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Desktop\book1.pdf", Quality _
:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End Sub