Thanks Ossie, I've made all of the adjustments, but haven't done the dialog
box yet. I've saved the code for when I get there. I'm learning
VB on VS
2008, so this is slightly different, but good practice.
I sincerely appreciate your help!
"OssieMac" wrote:
I've got a few minutes before I go out today so just a couple of comments.
You haven't changed the object variable from objWord to WordObject in the
clean up. I understand that memory problems can result if these object
variables are not set to nothing when no longer required. As the very first
line in the declarations section of the modules enter Option Explicit and
then when you are finished editing code click Debug - Compile VBA Project
and it picks up any code errors inclucing undeclared variables.
You can force Excel to automatically insert Option Explicit at the top of
modules in NEW projects /modules if you select Tools - Options and on the
Editor tab check Require Variable Declaration.
You have included the template name with the path string
SigCardPathString = "C:\Documents and Settings\nbk337h\Desktop\Excel Process
Docs\FL W9 Sig.dot"
I would do it this way by concatenating the path and the variable
SigCardTemplateString :-
SigCardTemplateString = "FL W9 Sig.dot"
SigCardPathString = "C:\Documents and Settings\nbk337h\" & _
"Desktop\Excel Process Docs\" & SigCardTemplateString
I pointed out the above for two reasons. One for concatenating the path with
the filename variable.
The other shows the method of inserting a line break in an otherwise single
line of code when the break is required in the middle of a string enclosed in
double quotes.
Close off the double quotes and use an ampersand and then the space and
underscore for the line break and then open the double quotes on the next
line for the remainder of the string.
You may have this done by the time you get this but the following is a code
sample for a message to user re the selections:-
Dim Response
Response = MsgBox("Account Number = " & AcctNumberString & vbCrLf & _
"Account Type = " & AcctTypeString & vbCrLf & _
"Account State = " & AcctStateString & vbCrLf & _
vbCrLf & "Click OK to confirm or Cancel to exit", _
vbOKCancel, "Selections for word document ")
If Response = vbCancel Then
MsgBox "Processing will terminate"
Exit Sub
End If
--
Regards,
OssieMac