Menu

Cannot open WordprocessingML

Help
2009-05-23
2012-12-07
  • Maynard Hogg

    Maynard Hogg - 2009-05-23

    I now enough VB to edit the path to the application, but the "filter=" line has me stumped.

    I copied the VBA script from the Appendix, loaded it into a .docx file, and ran it.

    First there was the "no .exe" error. No problem.

    Alas, the WordprocessingML in the next error means nothing to me.

    What am I doing wrong?

     
    • gnschmidt

      gnschmidt - 2009-05-26

      Hi Maynard

      Unless you're trying to open the Word document for spellchecking, you can considerably simplify the macro. (The WordprocessingML filter merely strips out binary blobs in the XML that get in the way of the spellcheck.)

      What exactly is it you'd like the application to do inside Word?

      Best,
      Gerald

      Sub xmlcopyeditor()
        On Error GoTo ErrorHandler
       
        Dim cmd As String
        Dim app As String
        Dim switch As String
        Dim doc As String
        Dim ruleset As String
        Dim filter As String
        Dim applicationDir As String
       
        app = Chr(34) _
          & "C:\Program Files\XML Copy Editor\xmlcopyeditor.exe" _
          & Chr(34)
       
        If Application.Documents.Count <> 0 Then
          If ActiveDocument.Path <> "" Then
            switch = "-w"
            doc = Chr(34) _
              & ActiveDocument.Path _
              & Application.PathSeparator _
              & ActiveDocument.Name & Chr(34)
          End If
        End If
       
        cmd = app & " " _
          & switch & " "_
          & doc & " "

        Shell cmd, vbNormalFocus
        On Error GoTo 0
        Exit Sub

      ErrorHandler:
        MsgBox "Unable to open XML Copy Editor"
      End Sub

       

Log in to post a comment.