Thanks! Re: Microsoft Word Create New Document
Thanks! Re: Microsoft Word Create New Document
- Subject: Thanks! Re: Microsoft Word Create New Document
- From: Gil Dawson <email@hidden>
- Date: Wed, 07 Dec 2016 16:13:23 -0800
Thanks, guys! We have a solution!
On Dec 7, 2016, at 2:52 PM, Ray Robertson < email@hidden> wrote: When you do the save as, the ReportDoc reference to the file is no longer valid.
That is consistent with my observations, but why?
After you do the save as, you could create a new reference immediately like this:
save as ReportDoc file name TargetFile set ReportDoc to active document
No, that doesn't seem to work. ReportDoc seems to have become a reference to whichever document becomes active during [the many-minute] execution.
But then... On Dec 7, 2016, at 3:06 PM, Stan Cleveland < email@hidden> wrote: It seems that the reference to ReportDoc disappears once the document is saved.
Yes, so we have noted. That seemed weird until... So you'll need to refer to the document by name from then on.
save as ReportDoc file name TargetFolder & TargetName tell document TargetName
Ah-hh-hh. This is beginning to make some sense now. Clearly, we want to keep the file name and the document name the same. Before the SaveAs, there was no filename, so the document had no name. (On screen it would show as "Untitled".) We could refer to the object using the ReportDoc variable, but that wasn't the document's name. After the SaveAs, the document has a name, so the object reference variable ReportDoc is no longer needed. I guess that makes sense, huh? ...and that works! It is exactly what I was looking for!
Thank you! Thank you! Stan and Ray!
--Gil |
_______________________________________________
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