A
Alexis
Hello guys
I have a document, template with forms, and I want to be able to update my
footer by entering information in my userform.
I can only make the update when my form is protected when I use the Field
FILL-IN, but with the field REF I can't.
with the FILL-IN field when i start a new document pops-up a window asking
me for this fields, and only after my userform.
But I want to be able to do that with my user form.
'This is the code that I have in my userform
Private Sub fillinbuttom_Click()
'no tanks Loaded
ntanks = UserForm1.notanks.Text
ActiveDocument.FormFields("ntanks").Result = ntanks
'input salg No
salg = UserForm1.salgno.Text
ActiveDocument.Bookmarks("salg").Range.Text = salgno
'input revison No
rev = UserForm1.revno.Text
ActiveDocument.Bookmarks("rev").Range.Text = revno
Unload Me
End Sub
'This is the code That I wrote for my module
Sub Formsfooterupdate()
' If document is protected, Unprotect it.
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:=""
End If
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Selection.WholeStory
Selection.Fields.Update
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
' ReProtect the document.
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True
End If
End Sub
But still I have the same problem and an error popup in
salg=userfor1.salgno.text
I think I am doing a mistake.
Could someone help me with this.
I have a document, template with forms, and I want to be able to update my
footer by entering information in my userform.
I can only make the update when my form is protected when I use the Field
FILL-IN, but with the field REF I can't.
with the FILL-IN field when i start a new document pops-up a window asking
me for this fields, and only after my userform.
But I want to be able to do that with my user form.
'This is the code that I have in my userform
Private Sub fillinbuttom_Click()
'no tanks Loaded
ntanks = UserForm1.notanks.Text
ActiveDocument.FormFields("ntanks").Result = ntanks
'input salg No
salg = UserForm1.salgno.Text
ActiveDocument.Bookmarks("salg").Range.Text = salgno
'input revison No
rev = UserForm1.revno.Text
ActiveDocument.Bookmarks("rev").Range.Text = revno
Unload Me
End Sub
'This is the code That I wrote for my module
Sub Formsfooterupdate()
' If document is protected, Unprotect it.
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:=""
End If
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Selection.WholeStory
Selection.Fields.Update
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
' ReProtect the document.
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True
End If
End Sub
But still I have the same problem and an error popup in
salg=userfor1.salgno.text
I think I am doing a mistake.
Could someone help me with this.