Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-29-2011, 05:03 AM
Knawl Knawl is offline Save Filename using Document Text Windows 2K Save Filename using Document Text Office XP
Novice
Save Filename using Document Text
 
Join Date: Sep 2011
Posts: 7
Knawl is on a distinguished road
Default Save Filename using Document Text

I am trying to automatically generate a filename when saving a document template.



The format is as follows:

Surname Initial - dob - reference number - AT3.doc



I want to use the text entered into a table in the document to generate the filename. The AT3 part at the end is always the same. The problem is that employees quite often get it wrong which makes files very difficult to find.
Reply With Quote
  #2  
Old 09-30-2011, 05:55 AM
OTPM OTPM is offline Save Filename using Document Text Windows 7 32bit Save Filename using Document Text Office 2010 32bit
Expert
 
Join Date: Apr 2011
Location: West Midlands
Posts: 981
OTPM is on a distinguished road
Default

Hi
Yes this can be done relatively easily with a macro.
Are these three pieces of information entered in three separate cells on a table or are they part of free text within the document?
Once I have this info I will see what I can do for you.
Tony(OTPM)
Reply With Quote
  #3  
Old 09-30-2011, 07:11 AM
Knawl Knawl is offline Save Filename using Document Text Windows 2K Save Filename using Document Text Office XP
Novice
Save Filename using Document Text
 
Join Date: Sep 2011
Posts: 7
Knawl is on a distinguished road
Default

Thank you OTPM.

The text would come from a table. So in the example attached the format would be saved automatically like so:

SURNAME INITIAL - D.O.B - App Ref No - AT2.doc

DOB format: 01.01.1990

I understand there may be formating issues which could be resolved with entering the data correctly within the table. Is it possible to use an input mask for this or perhaps a dialogue box when you open the file?

Many thanks.
Attached Files
File Type: zip AT2.zip (6.9 KB, 18 views)
Reply With Quote
  #4  
Old 09-30-2011, 07:13 AM
Knawl Knawl is offline Save Filename using Document Text Windows 2K Save Filename using Document Text Office XP
Novice
Save Filename using Document Text
 
Join Date: Sep 2011
Posts: 7
Knawl is on a distinguished road
Default

Sorry I uploaded the AT2 version instead of the AT3 one but the principle is the same.
Reply With Quote
  #5  
Old 09-30-2011, 08:23 AM
OTPM OTPM is offline Save Filename using Document Text Windows 7 32bit Save Filename using Document Text Office 2010 32bit
Expert
 
Join Date: Apr 2011
Location: West Midlands
Posts: 981
OTPM is on a distinguished road
Default

Hi
First of all you cannot use arithmetical operators in a filename. So a format of dd/mm/yyyy cannot be used. In the example I have used dd-mm-yyyy.
See template with code embedded herewith.
You need to change one line of code to suit your needs as follows:
ChDir "D:\Test Folder"
Change it to the location you want to save your files to.
As for putting a mask in the DoB cell you can do this if you set up an online form.
Hope this helps.
Good luck.
Tony
Attached Files
File Type: zip Pre Defined FileName Template.zip (28.4 KB, 7 views)
Reply With Quote
  #6  
Old 09-30-2011, 10:37 AM
Knawl Knawl is offline Save Filename using Document Text Windows 2K Save Filename using Document Text Office XP
Novice
Save Filename using Document Text
 
Join Date: Sep 2011
Posts: 7
Knawl is on a distinguished road
Default

Great almost there. I've just changed a few things. The dob format would have to be 01.01.1990 so I added .doc the end of RefNo.

My only problem is that these are stored in various directories and saving them to a specific one won't work. Is there any way of opening the 'save as' dialogue with the correct format present? It seems to be saving it in the default save path anyway rather than the ChDir specified path.
Attached Files
File Type: zip Pre Defined FileName Template.zip (30.0 KB, 5 views)
Reply With Quote
  #7  
Old 10-03-2011, 03:25 AM
OTPM OTPM is offline Save Filename using Document Text Windows 7 32bit Save Filename using Document Text Office 2010 32bit
Expert
 
Join Date: Apr 2011
Location: West Midlands
Posts: 981
OTPM is on a distinguished road
Default

Hi
The only issue now is that you cannot have more than one full stop in a filename as Microsoft looks for the first full stop in a filename and then uses wverything after it to determine which application was used to produce the document. Having 4 full stops in the filename will confuse Microsft Word. You will need to choose another separator for the date of birth other than a period or an arithmetic operator.
I will look at the other option you are after.
Tony
Reply With Quote
  #8  
Old 10-04-2011, 06:49 AM
Knawl Knawl is offline Save Filename using Document Text Windows 2K Save Filename using Document Text Office XP
Novice
Save Filename using Document Text
 
Join Date: Sep 2011
Posts: 7
Knawl is on a distinguished road
Default

Thanks Tony, I'm sure I can find another separator.
Reply With Quote
  #9  
Old 10-07-2011, 07:13 AM
OTPM OTPM is offline Save Filename using Document Text Windows 7 32bit Save Filename using Document Text Office 2010 32bit
Expert
 
Join Date: Apr 2011
Location: West Midlands
Posts: 981
OTPM is on a distinguished road
Default

Hi
Try this version and let me know how you get on.
Good luck.
Tony
Attached Files
File Type: zip Pre Defined FileName Template.zip (31.2 KB, 9 views)
Reply With Quote
  #10  
Old 10-07-2011, 07:26 AM
Knawl Knawl is offline Save Filename using Document Text Windows 2K Save Filename using Document Text Office XP
Novice
Save Filename using Document Text
 
Join Date: Sep 2011
Posts: 7
Knawl is on a distinguished road
Default

Perfect thank you!!!
Reply With Quote
  #11  
Old 10-10-2011, 12:23 AM
Knawl Knawl is offline Save Filename using Document Text Windows 2K Save Filename using Document Text Office XP
Novice
Save Filename using Document Text
 
Join Date: Sep 2011
Posts: 7
Knawl is on a distinguished road
Default

One last question if possible. I have imported the macro to my working document and adjusted the bookmarks. The macro works fine. However, if this document is passed to another user then the macro has disappeared. I know it's something to do with the normal template but how do I get the macro to stick within the document for each user?
Reply With Quote
  #12  
Old 10-10-2011, 03:00 AM
OTPM OTPM is offline Save Filename using Document Text Windows 7 32bit Save Filename using Document Text Office 2010 32bit
Expert
 
Join Date: Apr 2011
Location: West Midlands
Posts: 981
OTPM is on a distinguished road
Default

Hi
What you need to do is store the macro in the actual document rather than the template. Then wherever you send the document the macro will work.
Hope this helps.
Good luck.
Tony
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save Filename using Document Text Office '07: Shared document will not save AquaSabes Excel 1 09-22-2011 02:29 AM
Save Filename using Document Text Cannot save Word document don madsen Word 6 09-16-2011 09:02 PM
Word: The document 'Filename' caused a serious error the last time ... martincruise Word 0 02-25-2010 01:47 AM
Can't save word document in anything but read format Stuckie Word 0 01-21-2010 12:46 PM
Document Get Deleted When We save dil_09 Word 0 08-29-2009 09:59 PM

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 04:08 AM.


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