Re: Print MS Excel workbook / worksheet to PDF
Re: Print MS Excel workbook / worksheet to PDF
- Subject: Re: Print MS Excel workbook / worksheet to PDF
- From: Joe <email@hidden>
- Date: Tue, 24 May 2011 10:03:33 -0700
At 7:35 PM +0400 5/24/11, Leonid Bogdanov wrote:
>Hello!
>
> I'm trying to save a MS Excel workbook / worksheet into a single PDF file.
> MS Excel dictionary says that these objects have got "save workbook as" and "save as" commands, respectively.
>
> These commands have a file to which save a resulting PDF as an input parameter. But MS Excel creates several PDF files instead:
> single PDF file for every sheet in a workbook for a workbook and single file with a name of a sheet as postfix for a sheet.
>
> How can I save a workbook / worksheet to PDF file, exactly as I specified in command input. Any workarounds are welcomed, e.g.,
> easily merge several PDF files into one.
>
>Thank you.
Here is the code for a drag and drop applet to convert the active sheet in Excel to PDF.
(* Drag and drop conversion (duplication) of Microsoft Excel files to PDF files using Excel 2008. *)
on open fillist
set bs to "/"
set d to "-"
tell application "Finder"
set defLoc to container of (item 1 of fillist) as alias
end tell
set destn to choose folder with prompt "You are converting (duplicating) Excel files to PDF files" & return & "Select a location to save converted files." default location defLoc
repeat with lvar in fillist
tell application "Finder"
set thename to name of lvar
set filex to name extension of lvar
set l to length of filex
end tell
set nuname to text 1 thru text item -(l + 1) of thename
if "/" is in nuname then
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to bs
set txtLst to every text item of nuname as list
set AppleScript's text item delimiters to d
set nuname to txtLst as string
set AppleScript's text item delimiters to oldDelims
end if
set filname to (destn as string) & nuname & "pdf"
tell application "Microsoft Excel"
launch
open lvar
save as active sheet filename filname file format PDF file format
close window 1 saving no
end tell
end repeat
end open
HTH
Joe
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden