I’m trying to save a word doc that I’ve created via the com object to xml. I’ve created a macro in word and converted it to lotus script but for some reason I can get it to accept my xls style sheet that I got from microsoft to convert it to a fo file. Which I will then convert to a pdf. Any way here’s the code. Maybe a fresh pair of eyes will help. All I want to do is save the file as an xml file using the xls stylesheet.It works in word but not via this script.
Set wordapp = createObject( “word.Application” )
Call wordapp.documents.add("c:\template.dot") 'Create a new document based on the template "Task.Dot"
wordapp.Visible = False
wordapp.ActiveDocument.FormFields("Text1").Result = doc.CustAddress(0)
wordapp.ActiveDocument.FormFields("Text2").Result = doc.CustAddress(1)
wordapp.ActiveDocument.FormFields("Text3").Result = doc.CustAddress(2)
wordapp.ActiveDocument.FormFields("Text4").Result = doc.ProjectNumber(0)
wordapp.ActiveDocument.FormFields("Text5").Result = doc.TransmittalNumber(0)
wordapp.ActiveDocument.XMLSaveDataOnly = True
wordapp.ActiveDocument.XMLUseXSLTWhenSaving = True
wordapp.ActiveDocument.XMLSaveThroughXSLT ="C:\Office Samples\OfficeWordWordMLtoXSL-FO\Word2FO.xsl"
wordapp.ActiveDocument.XMLHideNamespaces = False
wordapp.ActiveDocument.XMLShowAdvancedErrors = False
wordapp.ActiveDocument.XMLSchemaReferences.HideValidationErrors = False
wordapp.ActiveDocument.XMLSchemaReferences.AutomaticValidation = True
wordapp.ActiveDocument.XMLSchemaReferences.IgnoreMixedContent = True
wordapp.ActiveDocument.XMLSchemaReferences.AllowSaveAsXMLWithoutValidation = True
wordapp.ActiveDocument.XMLSchemaReferences.ShowPlaceholderText = False
savestringxml = "c:\" + doc.TransmittalNumber(0) + ".xml"
'parms for saveas word document
wordapp.ActiveDocument.SaveAs "c:\test.xml",wdFormatXML
wordapp.ActiveDocument.Close
Call wordApp.Quit
Set wordapp = Nothing