Re: Scripting MS Word "Save As"
Re: Scripting MS Word "Save As"
- Subject: Re: Scripting MS Word "Save As"
- From: Bill Planey <email@hidden>
- Date: Fri, 01 Nov 2002 20:40:59 -0600
Eric,
You will need to use Visual Basic commands to accomplish this properly, due
to Word9s poor AS implementation. Try this:
set WDoc to 3the name of your file2 -- you need to set this variable
earlier in the process - the name of your front window, for example
set FDirectory to 3the name of the directory you want to save in2 --
ditto
tell application "Microsoft Word"
set quote to "\""
set theFileDirectory to " ChangeFileOpenDirectory _" & return &
,
quote & FDirectory & "\""
set theCommand to " ActiveDocument.SaveAs FileName:=" & quote &
WDoc & quote & ", FileFormat:= _
wdFormatText, LockComments:=False, Password:=\"\",
AddToRecentFiles:=True, _
WritePassword:=\"\", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveForms
Data:=False,
SaveAsAOCELetter:= _
False"
with timeout of 240 seconds use a timeout, just In case
do Visual Basic theCommand
end timeout
end tell
I haven9t tried this with the OSX version of Word, but it works fine with
earlier versions in Classic. At least it9s a starting point. In general, to
do anything serious via AppleScript in Word, you9ll have to record actions
so that you can get the VBA commands.
Good luck,
Bill Planey
On 11/1/02 10:16 AM, "Eric Anderson" <email@hidden> wrote:
>
I have an AppleScript that used to work in OS X 10.1.5, but doesn't work on
>
OS X 10.2. Here's the relevant code:
>
>
tell application "Microsoft Word"
>
>
set htmlfilealias to "[An HFS+ folder location ending in:]" & htmlfilename
>
>
set filetype to "Text only"
>
>
save document 1 in htmlfilealias as filetype
>
>
end tell
>
>
The problem is that I always get an AppleScript error "Can't make some data
>
into the expected type."
>
>
Any ideas?
>
>
TIA!
>
>
Eric Anderson
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.