chris9104
11-11-2011, 04:27 AM
Hi guys, I am using the below code to try to save a word doc as certain bookmarks within the doc, however the bit highlighted in red will not work, please can you help. The reference will always be a number by the way
Thanks!
Call ErrHandler
Dim strfilename As String
Dim Varref As String
Dim Varname As String
Dim Var1 As String
Var1 = ActiveDocument.Bookmarks("Reference").Range.Text
If Var1 = "00000" Then
MsgBox "Please enter an account number."
ActiveDocument.FormFields(6).Select
Exit Sub
End If
Verref = ActiveDocument.Bookmarks("Reference").Range.Text
Varname = ActiveDocument.Bookmarks("Name").Range.Text
strfilename = "C:\Documents and Settings\Owner\Desktop\Bills" & "\" & Varref & "-" & Varname & ".doc"
ActiveDocument.SaveAs filename:=strfilename
Application.DisplayAlerts = True
MsgBox "A copy has been saved to the bills file"
Thanks!
Call ErrHandler
Dim strfilename As String
Dim Varref As String
Dim Varname As String
Dim Var1 As String
Var1 = ActiveDocument.Bookmarks("Reference").Range.Text
If Var1 = "00000" Then
MsgBox "Please enter an account number."
ActiveDocument.FormFields(6).Select
Exit Sub
End If
Verref = ActiveDocument.Bookmarks("Reference").Range.Text
Varname = ActiveDocument.Bookmarks("Name").Range.Text
strfilename = "C:\Documents and Settings\Owner\Desktop\Bills" & "\" & Varref & "-" & Varname & ".doc"
ActiveDocument.SaveAs filename:=strfilename
Application.DisplayAlerts = True
MsgBox "A copy has been saved to the bills file"