Hi
I can't understand why the following does not detect when one of three fields had been changed, to validate a save function:
[vba]Private Sub UserForm_Initialize()
Dim changed As Boolean
changed = False
end sub
Private Sub code_Change()
changed = True
End Sub
Private Sub client_Change()
changed = True
End Sub
Private Sub path_Change()
changed = True
End Sub
Private Sub update_Click()
IF changed then
If code <> "" Then
Set oTemplate = Templates("O:\IT\code defaults.dot")
oTemplate.AutoTextEntries.Add code.Text & "|" & "client", Range:=Selection.Range
oTemplate.AutoTextEntries(code.Text & "|" & "client").Value = client.Text
oTemplate.AutoTextEntries.Add code.Text & "|" & "path", Range:=Selection.Range
oTemplate.AutoTextEntries(code.Text & "|" & "path").Value = path.Text
If oTemplate.Saved = False Then oTemplate.Save
MsgBox ("Client name and directory attached to client code")
Else
MsgBox ("There is no client code to attach client name and directory to")
End If
End If
End Sub
[/vba]
Why does 'changed' not become true and then allow the save?? Grateful for any ideas
thanks