msWord to html

hi,

i would like to know if it s possible and how (in Applescript) to open a word document (.doc) and save it as an html page in using word application. I try but it’s not ok.
Sorry for my english i m french :smiley:

thanks for answers

  • nicolas

This will save a Word document to your desktop with the name “test.html” (adjust the path to the Word document, of course):

Word is recordable. The only caveat is that in OS X, the Script Editor changes the line ending style so you’ll have to modify any hard returns in the recorded script with returns (as demonstrated in the code above).
Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

est ce que ce script est compatible OS X ?

merci

  • nico

Sorry, my French is rusty. Are you asking if this script is compatible with Mac OS X? If so, yes, the code above is compatible with Mac OS X.

Jon

i m sorry for use french language, yes it was my question and it s OK !!

Thank you, you understand well french

++ nicolas

If you are using Office 2004 you can do the following:

set word_document to choose file with prompt “Select the Word document to be
save as HTML” of type {“W8BN”}

tell application “Finder”
set doc_Name to name of file word_document
end tell

set desktop_path to ((path to desktop) as string)
set html_name to desktop_path & “test.html”

tell application “Microsoft Word”

open word_document
set my_Doc to the document named doc_Name
if exists my_Doc then
	save as my_Doc file name html_name file format format HTML
	close active document saving no
end if

end tell

Thank you for this new script, it’s ok

best regards

  • nicolas