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
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?
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