Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2006

Tip: Looking for answers? Try searching our database.

Help with automatic doc naming and correspondence ref numbering

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sharpe - 04 May 2006 10:57 GMT
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
Sharpe - 08 May 2006 06:11 GMT
All sorted thanks
For anyone else with similar problems
Sub FileSave()

 Dim myFile As String
 
   With ActiveDocument.FormFields
       myFile = .Item("bmkProjectNo").Result
       myFile = myFile & "-E" &
Format(ActiveDocument.BuiltInDocumentProperties("Creation Date"),
"yyMMddHhNn")
'        myFile = myFile & "-E" & 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
Sub FileSaveAs()

 Dim myFile As String
 
   With ActiveDocument.FormFields
       myFile = .Item("bmkProjectNo").Result
       myFile = myFile & "-E" &
Format(ActiveDocument.BuiltInDocumentProperties("Creation Date"),
"yyMMddHhNn")
'        myFile = myFile & "-E" & 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

> Hi
>
[quoted text clipped - 33 lines]
>    
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.