• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re[2]: Export MS Excel range to a PDF file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[2]: Export MS Excel range to a PDF file


  • Subject: Re[2]: Export MS Excel range to a PDF file
  • From: Cameron Knowlton <email@hidden>
  • Date: Mon, 23 May 2011 11:58:51 -0700

Title: Re[2]: Export MS Excel range to a PDF file
The script below will copy to the clipboard a named range (in my case, a table). (You can change the format... I used picture in my case).

The script below also captures 2 rows above the table, which is where I usually place my title and description of the data. Otherwise, eliminate the -2 reference below.

Hope this helps.
Cameron Knowlton


local namedTable, tableRange, tableRangeReference
local firstRowNum, firstColumnNum, lastColumnNum, lastRowNum, topLeftCell, bottomRightCell

tell application "Microsoft Excel"
  
set currentDoc to active workbook
      
set tableSheet to worksheet "mySheet" of currentDoc
    
       
-- find the named range
set namedTable to named item named "myNamedRange" of currentDoc
set tableRangeReference to reference range of namedTable
       
       
-- find the top left cell of the table (including title row)
   
set firstRowNum to (first row index of tableRangeReference) - 2
set firstColumnNum to (first column index of tableRangeReference)
      
set topLeftCell to get address (cell firstColumnNum of row firstRowNum) without row absolute and column absolute
       
       
-- find the bottom right cell of the table
     
set lastRowNum to (first row index of last row of tableRangeReference)
 
set columnCount to (count of columns of tableRangeReference)
   
set lastColumnNum to firstColumnNum + columnCount - 1
  
set bottomRightCell to get address (cell lastColumnNum of row lastRowNum) without row absolute and column absolute
     
       
set theTableRange to range (topLeftCell & ":" & bottomRightCell) of tableSheet
 
copy picture theTableRange appearance screen format picture
end tell



At 9:36 PM +0400 11/05/23, Leonid Bogdanov wrote:
I found a workaround for this issue: it turned out that MS Excel copies selected range object
into the Clipboard in a PDF format (among several others). Saving this PDF data from the Clipboard,
we'll get the desired range object in a PDF format.


Mon, 23 May 2011 09:17:05 -0700 letter from Paul Berkowitz <email@hidden>:

> I would try to work around that limitation by copying the range to a new
> workbook, then 'save workbook as [workbook] file format PDF file format',
> then (optionally) deleting the new workbook.
>
> I haven't tried it, but that's where I'd start. Check the 'save as' command
> in the Microsoft Excel Suite. It looks like it should be possible.
>
> --
> Paul Berkowitz
>
>
> > From: Leonid Bogdanov <email@hidden>
> > Reply-To: Leonid Bogdanov <email@hidden>
> > Date: Mon, 23 May 2011 13:09:41 +0400
> > To: AppleScript-Users <email@hidden>
> > Subject: Export MS Excel range to a PDF file
> >
> > Hello!
> >
> >     Does anybody have an example on how to export a MS Excel range object
> into
> > a PDF file?
> >     Windows version of MS Excel has an ability to programmatically save a
> > range object into a PDF file (exportAsFixedFormat() method in COM
> interface).
> >
> >     Sadly, a range object doesn't understand save or save as commands too.
> >
> > Thank you!

--
Cameron Knowlton
KnowledgeVine SEO Dashboards
email@hidden
P: 250.382.0226
http://www.knowledgevine.net
 _______________________________________________
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

References: 
 >Export MS Excel range to a PDF file (From: Leonid Bogdanov <email@hidden>)
 >Re[2]: Export MS Excel range to a PDF file (From: Leonid Bogdanov <email@hidden>)

  • Prev by Date: Re: two Filemaker Pro questions
  • Next by Date: Re: two Filemaker Pro questions
  • Previous by thread: Re[2]: Export MS Excel range to a PDF file
  • Next by thread: Slight deviation, big problem with script
  • Index(es):
    • Date
    • Thread