November 21st, 2009, 12:28 PM
Macro in Word 2007
Hi all and thanks for reading,
I am new at VB programming and am beating myself crazy on how to save a Word document using a user input in the document. Let me clarify, I have a document created with a macro that inserts the date, tracks it with a sequential number (using bookmarks with a text file) and saves it to our shared drive on the network (see below). I want the ability use the macro to save the document with a user input so to keep all documents organized. Maybe using their company ID or name. Any help would be greatly appreciated!
Order = System.PrivateProfileString("S:Sample.Txt", "MacroSettings", "Sample")
If Order = "" Then
Order = 1
Order = Order + 1
System.PrivateProfileString("S:\Sample.Txt", "MacroSettings", "Sample") = Order
ActiveDocument.Bookmarks("Sample").Range.InsertBefore Format(Order, "0000#")
ActiveDocument.SaveAs FileName:="S:\Sample " & Format(Order, "0000#")
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!