• 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: Alternatives to Word (was: Re: Script problems with BBEd
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alternatives to Word (was: Re: Script problems with BBEd


  • Subject: Re: Alternatives to Word (was: Re: Script problems with BBEd
  • From: billp <email@hidden>
  • Date: Mon, 10 Dec 2001 15:28:59 -0600

Scott,

Thanks for your suggestion. I am trying to make it work.
I wonder if it is important to have the Microsoft OLE Extension
active in my Extensions folder (OS 9.0.4) for it to work?
I have been told many times through the years that is extension
should be removed, and I always remove it. Is it essential
for an operation such as you describe below?

Thanks for the humorous bit about Enron!

Bill

>On Thu, 6 Dec 2001 19:16:05 -0600, billp <email@hidden> asked,
>
>> And while on the subject of Word and problems with it...
>>
>> What really screws me up is when a client sends over a Word file
>> wherein the tables have somehow been created in and linked to Excel;
>> you cannot, for example, select any text in the table within Word.
>> When you click somewhere on the table, handles appear (as on any graphic)
>> at the corners and in-between. Double-clicking takes you into Excel
>> where, finally, you can access the data at the character level.
>
>This is an embedded file, using Microsoft's Object Linking and Embedding
>"technology." The object consists of a graphic that provides the
>apperence of
>the object, and the actual spreadsheet file itself, so you can open it by
>double-clicking it.
>
>So I'd suggest you could get the embedded file to open in Excel, and then
>save
>it as tab-delimited text from there, rather than turning it into a Word
>table as
>an intermediary.
>
>[...]
>> What I cannot figure out how to do is to have AppleScript perceive
>> these things as the kinds of objects they are and to have them
>> automatically converted to the Word Table format. Has anyone out there
>dealt
>with
>> this?
>
>The AppleScript dictionary of Word doesn't expose this sort of object.
>You can
>use Visual Basic to access these things, and use AppleScript to run a
>piece of
>Visual Basic code to get what you want. Here are the fundamentals you may be
>able to use to build a solution from:
>
>An OLE object in a document is part of the document's "Shapes" collection.
> You
>can specifically identify Excel objects by their "Creator" property. Excel
>objects have 1297307460 as their creator. (That odd number is the integer
>representation of the four-byte 'XCEL' signature for Excel.) So, you can
>iterate through document's Shapes collection and get all the Excel objects:
>
> ' Warning: Visual Basic code follows. Viewer discretion is advised.
> For Each OLEobject in ActiveDocument.Shapes
> If OLEobject.Creator = 1297307460 then
> ' Do your processing of it here
> End If
> Next
>
>Now, just what is the processing to do? Probably the best thing to do
>would be
>to tell the object to activate, and then address further AppleScript
>commands to
>Microsoft Excel.
>
> -- AppleScript here, but with Visual Basic embedded. Safety Goggles
>required.
>
> tell application "Microsoft Word"
> do Visual Basic "For Each OLEobject in ActiveDocument.Shapes
> If OLEobject.Creator = 1297307460 then
> OLEobject.Activate
> End If
> Next "
>
> -- Now, all the Excel objects are open as worksheets inside the Excel
>application.
>
> tell application "Microsoft Excel"
> repeat until number of documents is 0
> save document 1 in "Disk:Table" & (number of documents) as xlText
> close document 1
> end repeat
> end tell
>
>So, the script above will find all the Excel objects in the Word document and
>activate them all. Then it will save each one and close it in Excel. Each
>table will be saved as tab-separated text, on the disk "Disk" with names
>"Table1", "Table2", etc.
>
>What happens if the embedded Excel spreadsheet has more data than is
>displayed,
>or has more than one worksheet pages, will influence what the "Save as
>xlText"
>produces and may produce some dialogs.
>
>If a company sends you a Word file that has an embedded spreadsheet, you
>may be
>getting way more information than you expected (and way more than they
>thought
>they were sending you.)
>
> ---------------------------------------
> | ENRON Annual Report (Word Document)
> |
> | Earnings: 12 Gazillion Dollars (Embedded Excel Spreadsheet)
> |
>
>
> ---------------------------------------
> ENRON Confidential Excel spreadsheet
>
> ---------------------------------------
> |Real Money: $ 5.23
> |Unjustified Hype: $ 12 Gazillion
> ---------------------------------------
> | Earnings: 12 Gazillion Dollars
> ---------------------------------------
> | Note: Make sure only the Earnings total appears in the annual report.
>
>--


  • Prev by Date: Re: Comments Field
  • Next by Date: Re: URL Access Scripting
  • Previous by thread: Re: Alternatives to Word (was: Re: Script problems with BBEd
  • Next by thread: Re: Alternatives to Word (was: Re: Script problems with BBEd
  • Index(es):
    • Date
    • Thread