Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Trouble saving XML format with Macro in Word 2003

Last post 04-03-2008 1:46 PM by mlcook. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 04-03-2008 1:46 PM

    • mlcook
    • Not Ranked
    • Joined on 04-03-2008
    • United States
    • New Member
    • Points 5

    Trouble saving XML format with Macro in Word 2003

    With Word 2003, I defined a macro (with Record New Macro) to try to save a Word document as an XML file.  I don't need schema validation; I just want to save the file as XML.

    I get the Visual Basic error message: "Run-time error '6119': This document cannot be saved as XML because its structure violates the rules set by one or more attached schemas."

    There should be no attached schemas, and I don't want the file validated anyway.

    Saving the file manually with "Save as..." and choosing the *.xml file type, and checking the "Save data only" box works fine.  The recorded macro, which I thought would go through these same steps, does not work.

    Suggestions appreciated.  The macro is below

    Mike

     

    Sub SaveXML()
    '
    ' SaveXML Macro
    '
        With ActiveDocument
            .XMLSaveDataOnly = True
            .XMLUseXSLTWhenSaving = False
            .XMLSaveThroughXSLT = ""
            .XMLHideNamespaces = False
            .XMLShowAdvancedErrors = True
            .XMLSchemaReferences.HideValidationErrors = True
            .XMLSchemaReferences.AutomaticValidation = False
            .XMLSchemaReferences.IgnoreMixedContent = False
            .XMLSchemaReferences.AllowSaveAsXMLWithoutValidation = True
            .XMLSchemaReferences.ShowPlaceholderText = False
        End With
        ActiveDocument.SaveAs FileName:="Process.xml", FileFormat:=wdFormatXML, _
            LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
            :="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
            SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
            False
    End Sub

    • Post Points: 5
Page 1 of 1 (1 items)