Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ty Ty is offline
external usenet poster
 
Posts: 3
Default Save/Print PDF on Mac

I'm trying to save (or print) a worksheet to PDF. I'm running Mac OS
X 10.3.9 and realize there's a compatibility issue with PC and Mac in
terms of .ActivePrinter application (see sample code below which was
used for this function on a PC). Is there a work around or some other
way to accomplish this in Excel (Office 2004) for Mac?

Simply, save a sheet as a .pdf file on a mac.

I've studied numerous posts on this subject but none of the code fully
fits my needs.
I'd greatly appreciate any help and guidance.

Cheers,
Ty

Sub pdfPrint()

Dim MyPath As String
Dim SourceString As String, OutputString As String, Suffix As String
Dim fName As String

fName = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4)
MyPath = "C:\Documents and Settings\EitanS.SSI\Desktop"
Suffix = Format(Date, "ddmmmyy")
OutputString = MyPath & "\" & fName & Suffix & ".pdf"

Application.ActivePrinter = "Adobe PDF on Ne01:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, printtofile:=True,
ActivePrinter:="Adobe PDF on Ne01:", Collate:=True,
prtofilename:=OutputString

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Save/Print PDF on Mac

As MacXL/VBA Help states, ActivePrinter doesn't work in MacXL, the reson
being that the system call for printing doesn't allow it (it *should* be
scriptable, but Apple hasn't made it so).

Of course, you could manually save as PDF from the print dialog, as with
any other Mac application.




In article .com,
"Ty" wrote:

I'm trying to save (or print) a worksheet to PDF. I'm running Mac OS
X 10.3.9 and realize there's a compatibility issue with PC and Mac in
terms of .ActivePrinter application (see sample code below which was
used for this function on a PC). Is there a work around or some other
way to accomplish this in Excel (Office 2004) for Mac?

Simply, save a sheet as a .pdf file on a mac.

I've studied numerous posts on this subject but none of the code fully
fits my needs.
I'd greatly appreciate any help and guidance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Save/Print PDF on Mac

Not using a Mac here, so I'm guessing, but the Mac does not use "\" in
paths. Is it a ":" ?

Also I would doubt the printer would be "Adobe PDF on Ne01:".
You can test the name by setting the printer the PDF printer then in the
immediate window
?Application.ActivePrinter

This of course assume the user has Adobe installed on their system.

However, this code actually outputs a PostScript file (.ps) that you then
need to send to Distiller.
e.g. OutputString = MyPath & "\" & fName & Suffix & ".ps"

See the recent thread in this NG "Converting Excel worksheet to PDF then
print" for the Distiller part.

All this assumes that the Mac/Acrobat works the same as the PC version ??

NickHK

"Ty" wrote in message
oups.com...
I'm trying to save (or print) a worksheet to PDF. I'm running Mac OS
X 10.3.9 and realize there's a compatibility issue with PC and Mac in
terms of .ActivePrinter application (see sample code below which was
used for this function on a PC). Is there a work around or some other
way to accomplish this in Excel (Office 2004) for Mac?

Simply, save a sheet as a .pdf file on a mac.

I've studied numerous posts on this subject but none of the code fully
fits my needs.
I'd greatly appreciate any help and guidance.

Cheers,
Ty

Sub pdfPrint()

Dim MyPath As String
Dim SourceString As String, OutputString As String, Suffix As String
Dim fName As String

fName = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4)
MyPath = "C:\Documents and Settings\EitanS.SSI\Desktop"
Suffix = Format(Date, "ddmmmyy")
OutputString = MyPath & "\" & fName & Suffix & ".pdf"

Application.ActivePrinter = "Adobe PDF on Ne01:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, printtofile:=True,
ActivePrinter:="Adobe PDF on Ne01:", Collate:=True,
prtofilename:=OutputString

End Sub



Reply
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
Save as PDF not same size as Print and Print Preview in Excel Jack_Sprat Excel Discussion (Misc queries) 4 April 13th 09 06:38 PM
save as or print to pdf HelSue Excel Discussion (Misc queries) 4 February 16th 09 08:06 PM
excell won't print wants to save not print medic13 New Users to Excel 2 April 12th 06 05:52 PM
Save, Save As, Print Grayed Out when instance created via VBA/VB6 Jake Marx[_2_] Excel Programming 0 September 22nd 03 10:16 PM
Save, Save As, Print Grayed Out when instance created via VBA/VB6 jaf Excel Programming 0 September 22nd 03 09:23 PM


All times are GMT +1. The time now is 11:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"