Convert active excel wksht to pdf file
Solved/Closed
Related:
- Xlqualitystandard
- Save as pdf office 2007 - Download - Other
- Windows 10 iso file download 64-bit - Download - Windows
- Convert number to words in excel - Guide
- Convert m3u to mp3 - Guide
- Kmspico zip file download - Download - Other
2 responses
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Mar 12, 2010 at 04:38 AM
Mar 12, 2010 at 04:38 AM
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 January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Mar 12, 2010 at 10:14 AM
Mar 12, 2010 at 10:14 AM
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 January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
>
onedog
Mar 12, 2010 at 01:47 PM
Mar 12, 2010 at 01:47 PM
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 January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
>
onedog
Mar 12, 2010 at 02:28 PM
Mar 12, 2010 at 02:28 PM
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 January 28, 2010
Status
Contributor
Last seen
May 5, 2022
Mar 12, 2010 at 02:49 PM
Mar 12, 2010 at 02:49 PM
I just uploaded my file.
Mar 12, 2010 at 08:46 AM
Mar 12, 2010 at 08:57 AM
Mar 12, 2010 at 09:52 AM
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