P
Peter
Hello everyone,
I am working on distributing a VBA utility an want to distribute in the
easest possible way for people to install and use.
I would like to distribute it as a single Word .DOC file that will contain
both the documentation and the VBA. The document will contain buttons to
install the code in the .../WORD/STARTUP folder and also uninstall it. The
utilility will be launched by a toolbar button.
The fall back method (which is working) to distribute it as a .DOC (with
document and Install button) and a seperate .DOT file.
The install code is given below but there is a problem (isn't there always).
1. It will run correctly if I click the RUN button in the VBA editor but if
I click a button in the document I get a "Runtime eror 4198. Cpommand failed"
2. Sometimes, when Word is restarted I get a message saying that the
template in the STARTUP folder is "not valid"
Does anyone have any suggestions on how to get around this problem so I
distribute a single file.
Thanks in anticipation of receiving lots of helpful suggestions,
Peter
http://members.dodo.com.au/bakerevans/
------
Sub install()
Dim destfile As String
Dim sourceFile As String
Dim thisfile As String
Dim theMessage
theMessage = "Do you want to install Word Purge?" & vbCrLf
If MsgBox(theMessage, vbYesNo) = vbYes Then
'name of this file
thisfile = Application.ActiveDocument.FullName
destfile = Options.DefaultFilePath(wdStartupPath) & _
Application.PathSeparator & "Word Purge.dot"
sourceFile = Application.ActiveDocument.Path & _
Application.PathSeparator & "Word Purge.dot"
ActiveDocument.SaveAs FileName:=destfile, _
FileFormat:=wdFormatTemplate
End If
end sub
I am working on distributing a VBA utility an want to distribute in the
easest possible way for people to install and use.
I would like to distribute it as a single Word .DOC file that will contain
both the documentation and the VBA. The document will contain buttons to
install the code in the .../WORD/STARTUP folder and also uninstall it. The
utilility will be launched by a toolbar button.
The fall back method (which is working) to distribute it as a .DOC (with
document and Install button) and a seperate .DOT file.
The install code is given below but there is a problem (isn't there always).
1. It will run correctly if I click the RUN button in the VBA editor but if
I click a button in the document I get a "Runtime eror 4198. Cpommand failed"
2. Sometimes, when Word is restarted I get a message saying that the
template in the STARTUP folder is "not valid"
Does anyone have any suggestions on how to get around this problem so I
distribute a single file.
Thanks in anticipation of receiving lots of helpful suggestions,
Peter
http://members.dodo.com.au/bakerevans/
------
Sub install()
Dim destfile As String
Dim sourceFile As String
Dim thisfile As String
Dim theMessage
theMessage = "Do you want to install Word Purge?" & vbCrLf
If MsgBox(theMessage, vbYesNo) = vbYes Then
'name of this file
thisfile = Application.ActiveDocument.FullName
destfile = Options.DefaultFilePath(wdStartupPath) & _
Application.PathSeparator & "Word Purge.dot"
sourceFile = Application.ActiveDocument.Path & _
Application.PathSeparator & "Word Purge.dot"
ActiveDocument.SaveAs FileName:=destfile, _
FileFormat:=wdFormatTemplate
End If
end sub