Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-15-2013, 10:56 AM
Gary Drumm Gary Drumm is offline Automated file names Windows XP Automated file names Office 2007
Advanced Beginner
Automated file names
 
Join Date: Mar 2012
Posts: 86
Gary Drumm is on a distinguished road
Default Automated file names

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
Reply With Quote
  #2  
Old 04-16-2013, 05:34 AM
OTPM OTPM is offline Automated file names Windows 7 32bit Automated file names Office 2010 32bit
Expert
 
Join Date: Apr 2011
Location: West Midlands
Posts: 981
OTPM is on a distinguished road
Default

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
Reply With Quote
  #3  
Old 04-17-2013, 11:24 AM
Gary Drumm Gary Drumm is offline Automated file names Windows XP Automated file names Office 2007
Advanced Beginner
Automated file names
 
Join Date: Mar 2012
Posts: 86
Gary Drumm is on a distinguished road
Default

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
Reply With Quote
  #4  
Old 04-17-2013, 11:30 AM
Gary Drumm Gary Drumm is offline Automated file names Windows XP Automated file names Office 2007
Advanced Beginner
Automated file names
 
Join Date: Mar 2012
Posts: 86
Gary Drumm is on a distinguished road
Default

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
Reply With Quote
Reply



Similar Threads
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
Automated file names Automated pst file backup jbarr11 Outlook 1 04-17-2011 05:28 PM
Automated file names Need an Automated sql query for the Excel file 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

Other Forums: Access Forums

All times are GMT -7. The time now is 10:01 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft