LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mia Mia is offline
external usenet poster
 
Posts: 101
Default Saving as PDF and printing in a macro

I want to program a macro that should print to sepcified printer and save as
PDF.
I´m working in a network so not everyone can print a PDF but can save as PDF.

The PDF-file should be saved in a ftp-fil
"ftp://srv.gulle.com\guu\vis\test.pdf"
and the name should be from a cel Meny!F21. Meny!F21 are linked to another
sheet
so its only formula and no text.


My macro that i Have started with and works when I´m only want to select a
printer:


Sub menyskrivbeviskomplett()
'
' menyskrivbeviskomplett Makro
'

Sheets("Försäkringsbevis").Select

Dim str As String

Dim strNetworkPrinter As String
str = Application.ActivePrinter

strNetworkPrinter = GetFullNetworkPrinterName("\\Server01\NRG DSc428 PCL
6 Färg")

If Len(strNetworkPrinter) 0 Then
Application.ActivePrinter = strNetworkPrinter

ActiveWindow.SelectedSheets.PrintOut Copies:=1

End If

Application.ActivePrinter = str

Sheets("Meny").Select
End Sub

Function GetFullNetworkPrinterName(strNetworkPrinterName As String) As String
Dim strCurrentPrinterName As String, strTempPrinterName As String, i As
Long
strCurrentPrinterName = Application.ActivePrinter
i = 0
Do While i < 100
strTempPrinterName = strNetworkPrinterName & " på Ne" & Format(i,
"00") & ":"
On Error Resume Next ' try to change to the network printer
Application.ActivePrinter = strTempPrinterName
On Error GoTo 0
If Application.ActivePrinter = strTempPrinterName Then
GetFullNetworkPrinterName = strTempPrinterName
i = 100 ' makes the loop end
End If
i = i + 1
Loop
Application.ActivePrinter = strCurrentPrinterName ' change back to
the original printer
End Function
 
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
saving printing settings in excel 2007 Judy Excel Discussion (Misc queries) 0 July 28th 08 10:51 PM
Printing and saving problems Andrew H Excel Discussion (Misc queries) 1 August 7th 07 07:53 PM
Saving a spreadsheet without saving the Macro tedd13 Excel Programming 7 March 31st 06 02:17 PM
Printing and saving file. Prasad Vanka Excel Programming 0 May 26th 04 11:01 AM
macro to automatically check spelling before printing and before saving dgb Excel Programming 0 September 24th 03 12:53 PM


All times are GMT +1. The time now is 09:29 AM.

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"