S
Sharpe
Hi
I am new to VBA and have got this far with ideas and code from this forum,
thanks.
I ve started with a basic fax template and the code below works fine in
proposing a file name when the dialog box pops up etc. I have a ref field on
the fax that ref's the SaveDate or CreateDate and I can get this to reverse
and match my proposed file name.
My problem is depending how quick I fill in the fax I can end up with my
file name and the ref field being out by a minute. Another problem is that I
cant get the ref field (in a protected section) to update without printing it
first or right mousing it.
Any ideas on how I can get the ref or form fields and the reverse date
section of my file name to match always would be appreciated. (or is there an
easier way?)
Thanks
Sub FileSave()
Dim myFile As String
With ActiveDocument.FormFields
myFile = .Item("bmkProjectNo").Result
myFile = myFile & "-F" & Format(Now, "yyMMddHhNn")
myFile = myFile & Application.UserInitials
myFile = myFile & "-" & .Item("bmkSubject").Result
End With
With Dialogs(wdDialogFileSaveAs)
.Name = myFile
If .Display <> -1 Then
Exit Sub
End If
.Execute
End With
End Sub
I am new to VBA and have got this far with ideas and code from this forum,
thanks.
I ve started with a basic fax template and the code below works fine in
proposing a file name when the dialog box pops up etc. I have a ref field on
the fax that ref's the SaveDate or CreateDate and I can get this to reverse
and match my proposed file name.
My problem is depending how quick I fill in the fax I can end up with my
file name and the ref field being out by a minute. Another problem is that I
cant get the ref field (in a protected section) to update without printing it
first or right mousing it.
Any ideas on how I can get the ref or form fields and the reverse date
section of my file name to match always would be appreciated. (or is there an
easier way?)
Thanks
Sub FileSave()
Dim myFile As String
With ActiveDocument.FormFields
myFile = .Item("bmkProjectNo").Result
myFile = myFile & "-F" & Format(Now, "yyMMddHhNn")
myFile = myFile & Application.UserInitials
myFile = myFile & "-" & .Item("bmkSubject").Result
End With
With Dialogs(wdDialogFileSaveAs)
.Name = myFile
If .Display <> -1 Then
Exit Sub
End If
.Execute
End With
End Sub