RE: How to specify print file in MS Excel 2004?
RE: How to specify print file in MS Excel 2004?
- Subject: RE: How to specify print file in MS Excel 2004?
- From: Richard Rönnbäck <email@hidden>
- Date: Wed, 26 Jan 2005 07:47:07 +0100
Title: RE: How to specify print file in MS Excel 2004?
Thanks Michael,
I came up with a slight variation of that, but your method might be better, since it involves one less application, so I might try the "as alias" of "if exists" method instead. Here's what my script looks like at the moment:
tell application "Microsoft Excel"
set myPath to path of workbook 1
repeat with i from 1 to count of worksheets of workbook 1
set theSheet to worksheet i
set myName to name of theSheet
print out theSheet with print to file
tell application "Printer Setup Utility"
launch
set myInitTime to current date
repeat while status of printer "Adobe PDF" is printing
delay 1
end repeat
end tell
tell application "Finder"
set myFile to (document file 1 of folder myPath whose name extension is "pdf" and creation date is greater than myInitTime)
set name of myFile to (myName & ".pdf")
set myPDF_FileName to myPath & ":" & (myName & ".pdf")
end tell
tell application "Microsoft Entourage"
set myMsg to make new outgoing message at end with properties {recipient:myName, subject:myName, content:"innehåll", attachment:myPDF_FileName}
end tell
tell application "Finder"
move myPDF_FileName to trash
end tell
end repeat
(* activate
display dialog "finished" *)
end tell
Thanks,
--
Richard Rönnbäck
> Från: Michael Conner <email@hidden>
> Datum: Tue, 25 Jan 2005 16:45:25 -0600
> Till: applescript <email@hidden>
> Ämne: Re: How to specify print file in MS Excel 2004?
>
> I'm just an AS dabbler, but here is the way I do this when having to output
> a series of PDF files from a FileMaker database. I have to do a test to see
> where the PDF file will be created, which will by default be the name of the
> Filemaker file with a PDF extension each time the print is called. This can
> be hard corded in the script or entered through a dialog. Then I have Finder
> watch for the file and change its name before the script continues.
>
> tell application "Finder"
> set vDone to 0
> repeat until vDone = 1
> try
> set pdfile to file NameofPDFfile as alias
> set name of pdfile to NewNameofPDF
> set vDone to 1
> on error
> delay 10
> end try
> end repeat
> end tell
>
>
> The NameofPDFfile would be the same for each sheet, and the new name
> generated from the worksheet name or number. Make sure a file with the
> default name doesn't exist before running or test for it and delete it.
>
> Mike Conner
>
>
> on 1/25/05 1:16 PM, Richard Rönnbäck at email@hidden wrote:
>
>> I am trying to print each sheet as a separate PDF file in Excel 2004, but I
>> can't find how to set the name and location of the print file.
>>
>> Assuming that the Active printer is Adobe PDF (distiller) the code below
>> will output the file, but is there any way to tell Excel where to put the
>> file, and more importantly, how to name it?
>>
>> tell application "Microsoft Excel"
>> tell workbook 1
>> set theSheet to worksheet 1
>> print out theSheet with print to file --active printer "Adobe_PDF"
>> end tell
>> end tell
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Applescript-users mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> edu
>>
>> This email sent to email@hidden
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Applescript-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> edband.net
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden