![]() |
|
#1
|
|||
|
|||
![]()
We are developing some unique documents, using a home-made template.
They are called JSA's (Job Safety Analysis), and one would be written for every dangerous job in the factory, to advise workers on how to avoid accidents, etc. How might we be able to apply unique filenames for each newly created document so that the creators don't step on each other? I thought of the creators initials being used as part of the filename, and then they (the creators) would only need to insure that they catalog the documents they created as ...1, ...2, ...3, etc. Has anyone seen a good way to accomplish this without a lot of oversite? Thanks, Gary |
#2
|
|||
|
|||
![]()
Hi Gary
You could use this macro in your template: Sub fName() Dim fName As String Dim lngStart As Long Dim lngEnd As Long 'find customer name starting and ending positions 'which will be between the "_" and "." in the file name lngStart = InStr(ActiveDocument.Name, "-") lngEnd = InStr(ActiveDocument.Name, ".") 'pull customer name out of the file name DocNum = Mid(ActiveDocument.Name, lngStart + 1, lngEnd - lngStart - 1) DocNum = DocNum + 1 TempFileName = Mid(ActiveDocument.Name, 1, lngStart) ActiveDocument.SaveAs FileName:=TempFileName & DocNum End Sub Your filename (in this instance) would be "Test Unique Filename-0" to start with. Each time the macro is run the document is saved by incrmenting the number at the end of the filename by 1 and saving it in its current location. You could either add a shortcut to this macro or modify the toolbar in this template by assigning this macro to the SaveButton on the Toolbar. Hope this helps. Good luck. Tony |
#3
|
|||
|
|||
![]()
I did try the Macro, and it worked, but it will not be practical in our environment.
How can I get rid of it? Word keeps saving and recovering it (the file). Even when I indicate that I don't want it saved, it still recovers it. I searched for a similar post, (delete macro) but didn't find one. Thanks, Gary Last edited by Gary Drumm; 04-17-2013 at 11:30 AM. Reason: Clarification |
#4
|
|||
|
|||
![]()
Word wanted to send a report to MS, and had a check box to save. I deselected, and choose Do Not Send.
Never mind, I figured it out. Opened the Macro, selected everything, and then cut. Clicked okay, or yes at the pop-up about continuing. Saved the document, and re-opened, and the macro was gone. Thanks, Gary Last edited by Gary Drumm; 04-17-2013 at 11:38 AM. Reason: Update and typo |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Add text to all file names in folder | cure4glass | Office | 3 | 04-06-2012 04:23 PM |
How to enter names in Resource Pool/names | pstein | Project | 1 | 03-26-2012 07:37 AM |
![]() |
jbarr11 | Outlook | 1 | 04-17-2011 05:28 PM |
![]() |
Karthick | Excel | 3 | 12-20-2010 04:52 AM |
Two Different Names in the Same File | kathy carson | Outlook | 0 | 02-14-2006 01:02 PM |