Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word Macro for saving documents

Status
Not open for further replies.

QueTech

MIS
Apr 13, 2003
79
US
I am using MS Word and VB 6.3. I need to save my document at the close of the document. I would like to code the path and filename of the document. My current code is below, this code works so far, however, Words save dialogue box opens after I exit the save dialogue box I created. Can I stop Words save dialogue box from opening? Also what is the correct format if I want to add the current date and time to my file name.

Option Explicit
Private Sub CommandButton1_Click()
ActiveDocument.SaveAs filename:="C:\temp\TEST3"
Unload SaveYourFile
ActiveDocument.Close
End Sub

Private Sub CommandButton2_Click()
Unload SaveYourFile
ActiveDocument.Close
End Sub



Private Sub TextBox1_Enter()
TextBox1.Text = "C:\temp\TEST3"
End Sub

Private Sub UserForm_Click()

End Sub
 
How about adding the savechanges syntax to your save method? ...

Code:
Option Explicit

Private Sub CommandButton1_Click()
    ActiveDocument.SaveAs filename:="C:\temp\TEST3"
    Unload SaveYourFile
    ActiveDocument.Close SaveChanges:=False
End Sub

Private Sub CommandButton2_Click()
    Unload SaveYourFile
    ActiveDocument.Close SaveChanges:=False '??
End Sub

-----------
Regards,
Zack Barresse
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top