![]() |
Save as pdf with special name
Hi,
I'm trying to save a sheet with a namn from the sheet as a pdf. Do anyone know what I should change in my code below to make it work? Sub Saveas() ' Saveas Makro ' ' Dim Namn As Integer Sheets("Blad2").Select Namn = Range("A1").Value ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ "M:\mc\Fevis\Namn.pdf", Quality:=xlQualityStandard, _ IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _ False Sheets("Blad1").Select End Sub BR Mia |
Save as pdf with special name
Use this
You can remove the date/time stamp if you want Sub RDB_PDF_ActiveSheet() Dim FilenameStr As String If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _ & Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") < "" Then FilenameStr = Application.DefaultFilePath & "\" & _ ActiveSheet.Name & " " & Format(Now, "dd-mmm-yy h-mm-ss") & ".pdf" ActiveSheet.ExportAsFixedFormat _ Type:=xlTypePDF, _ Filename:=FilenameStr, _ Quality:=xlQualityStandard, _ IncludeDocProperties:=True, _ IgnorePrintAreas:=False, _ OpenAfterPublish:=False MsgBox "You can find the PDF file here : " & FilenameStr Else MsgBox "PDF add-in Not Installed" End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Mia" wrote in message ... Hi, I'm trying to save a sheet with a namn from the sheet as a pdf. Do anyone know what I should change in my code below to make it work? Sub Saveas() ' Saveas Makro ' ' Dim Namn As Integer Sheets("Blad2").Select Namn = Range("A1").Value ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ "M:\mc\Fevis\Namn.pdf", Quality:=xlQualityStandard, _ IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _ False Sheets("Blad1").Select End Sub BR Mia |
Save as pdf with special name
Hi Ron,
It did not solve my problem completely. I want the pdf to always be saved at the sam place. M:\mc\Fevis\ And I also want the name to be from one cell in the active sheet. Is it possible? BR Mia "Ron de Bruin" skrev: Use this You can remove the date/time stamp if you want Sub RDB_PDF_ActiveSheet() Dim FilenameStr As String If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _ & Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") < "" Then FilenameStr = Application.DefaultFilePath & "\" & _ ActiveSheet.Name & " " & Format(Now, "dd-mmm-yy h-mm-ss") & ".pdf" ActiveSheet.ExportAsFixedFormat _ Type:=xlTypePDF, _ Filename:=FilenameStr, _ Quality:=xlQualityStandard, _ IncludeDocProperties:=True, _ IgnorePrintAreas:=False, _ OpenAfterPublish:=False MsgBox "You can find the PDF file here : " & FilenameStr Else MsgBox "PDF add-in Not Installed" End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Mia" wrote in message ... Hi, I'm trying to save a sheet with a namn from the sheet as a pdf. Do anyone know what I should change in my code below to make it work? Sub Saveas() ' Saveas Makro ' ' Dim Namn As Integer Sheets("Blad2").Select Namn = Range("A1").Value ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ "M:\mc\Fevis\Namn.pdf", Quality:=xlQualityStandard, _ IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _ False Sheets("Blad1").Select End Sub BR Mia |
Save as pdf with special name
Use this then
Sub RDB_PDF_ActiveSheet_2() Dim FilenameStr As String If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _ & Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") < "" Then FilenameStr = "M:\mc\Fevis\" & _ ActiveSheet.Range("A1").Value & " " & Format(Now, "dd-mmm-yy h-mm-ss") & ".pdf" ActiveSheet.ExportAsFixedFormat _ Type:=xlTypePDF, _ Filename:=FilenameStr, _ Quality:=xlQualityStandard, _ IncludeDocProperties:=True, _ IgnorePrintAreas:=False, _ OpenAfterPublish:=False MsgBox "You can find the PDF file here : " & FilenameStr Else MsgBox "PDF add-in Not Installed" End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Mia" wrote in message ... Hi Ron, It did not solve my problem completely. I want the pdf to always be saved at the sam place. M:\mc\Fevis\ And I also want the name to be from one cell in the active sheet. Is it possible? BR Mia "Ron de Bruin" skrev: Use this You can remove the date/time stamp if you want Sub RDB_PDF_ActiveSheet() Dim FilenameStr As String If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _ & Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") < "" Then FilenameStr = Application.DefaultFilePath & "\" & _ ActiveSheet.Name & " " & Format(Now, "dd-mmm-yy h-mm-ss") & ".pdf" ActiveSheet.ExportAsFixedFormat _ Type:=xlTypePDF, _ Filename:=FilenameStr, _ Quality:=xlQualityStandard, _ IncludeDocProperties:=True, _ IgnorePrintAreas:=False, _ OpenAfterPublish:=False MsgBox "You can find the PDF file here : " & FilenameStr Else MsgBox "PDF add-in Not Installed" End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Mia" wrote in message ... Hi, I'm trying to save a sheet with a namn from the sheet as a pdf. Do anyone know what I should change in my code below to make it work? Sub Saveas() ' Saveas Makro ' ' Dim Namn As Integer Sheets("Blad2").Select Namn = Range("A1").Value ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ "M:\mc\Fevis\Namn.pdf", Quality:=xlQualityStandard, _ IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _ False Sheets("Blad1").Select End Sub BR Mia |
Save as pdf with special name
Hi Ron,
You are briliant! Thank you wery much! BR Mia "Ron de Bruin" skrev: Use this then Sub RDB_PDF_ActiveSheet_2() Dim FilenameStr As String If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _ & Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") < "" Then FilenameStr = "M:\mc\Fevis\" & _ ActiveSheet.Range("A1").Value & " " & Format(Now, "dd-mmm-yy h-mm-ss") & ".pdf" ActiveSheet.ExportAsFixedFormat _ Type:=xlTypePDF, _ Filename:=FilenameStr, _ Quality:=xlQualityStandard, _ IncludeDocProperties:=True, _ IgnorePrintAreas:=False, _ OpenAfterPublish:=False MsgBox "You can find the PDF file here : " & FilenameStr Else MsgBox "PDF add-in Not Installed" End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Mia" wrote in message ... Hi Ron, It did not solve my problem completely. I want the pdf to always be saved at the sam place. M:\mc\Fevis\ And I also want the name to be from one cell in the active sheet. Is it possible? BR Mia "Ron de Bruin" skrev: Use this You can remove the date/time stamp if you want Sub RDB_PDF_ActiveSheet() Dim FilenameStr As String If Dir(Environ("commonprogramfiles") & "\Microsoft Shared\OFFICE" _ & Format(Val(Application.Version), "00") & "\EXP_PDF.DLL") < "" Then FilenameStr = Application.DefaultFilePath & "\" & _ ActiveSheet.Name & " " & Format(Now, "dd-mmm-yy h-mm-ss") & ".pdf" ActiveSheet.ExportAsFixedFormat _ Type:=xlTypePDF, _ Filename:=FilenameStr, _ Quality:=xlQualityStandard, _ IncludeDocProperties:=True, _ IgnorePrintAreas:=False, _ OpenAfterPublish:=False MsgBox "You can find the PDF file here : " & FilenameStr Else MsgBox "PDF add-in Not Installed" End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Mia" wrote in message ... Hi, I'm trying to save a sheet with a namn from the sheet as a pdf. Do anyone know what I should change in my code below to make it work? Sub Saveas() ' Saveas Makro ' ' Dim Namn As Integer Sheets("Blad2").Select Namn = Range("A1").Value ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ "M:\mc\Fevis\Namn.pdf", Quality:=xlQualityStandard, _ IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _ False Sheets("Blad1").Select End Sub BR Mia |
All times are GMT +1. The time now is 03:32 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com