• We invite you to join UKWorkshop.
    Members can turn off viewing Ads!

Saving Word Docs

UKworkshop.co.uk

Help Support UKworkshop.co.uk:

Steve Maskery

Established Member
Joined
26 Apr 2004
Messages
11,799
Reaction score
142
Location
Kirkby-in-Ashfield
Hi all,
Like most people, I guess, I have subdirectories to My Documents. In Word, I can change the default folder if I want, but as I understant it, that becomes the default for all docs.

What I want is to have different defaults, depending on what template is the basis of the document.

For example, if I create a doc from my Invoice.dot, I would like the default fle save path to be My Documents/Invoices/Unpaid. When I'm creating a new article with WoodArticle.dot I want it to be My Docs/Wood Articles, etc.

Anyone know if I can do this?

Cheers
Steve
 

dedee

Established Member
Joined
24 Jul 2003
Messages
2,637
Reaction score
1
Location
14860, France
Steve,
I've just tried this at work on Word 2003 the first folder that comes up is the one where the template is saved so if you put your wordarticle.dot in the My Docs/WordArticles folder you should be OK.

Andy
 

Steve Maskery

Established Member
Joined
26 Apr 2004
Messages
11,799
Reaction score
142
Location
Kirkby-in-Ashfield
Thank you both. I have it sorted.

There is an AUtoRun facility, and I can stor that in a particular template. I've not done any VBA programming for years, but the code is only two lines, and I can record it directly by changing the path manually whilst recording, then saving the template. Normal.dot has one path, Invoice.dot has a different one.

Perfect!

TVM
Steve
 

Steve Maskery

Established Member
Joined
26 Apr 2004
Messages
11,799
Reaction score
142
Location
Kirkby-in-Ashfield
Hmm, I spoke too soon.
Yes I have a macro which works, but it doesn't auto run. I must have it in the wrong place. I hope that, after gettting this far, it's not a case that it only works if it is in Normal.dot, which rather defeats the object!

I'll keep tinkering.

Steve
 

RogerS

Established Member
Joined
20 Feb 2004
Messages
17,391
Reaction score
78
Location
In the eternally wet North
I just played around a bit but I'm noit an expert. I created a template called woodworking.dot. Then recorded a macro which would save it to a folder called woodworking. I wanted to assign a keystroke to it and tried ctrl-shift-S but once in the document and editing that combo through up the style sheet.

However, manually running the macro did stick it in the right folder..so all you need do is alter your ctrl-S and have it changeable for each template :lol:

EDIT - you got me wondering now and so I've posted a question on experts exchange and we'll see what we get.
 

RogerS

Established Member
Joined
20 Feb 2004
Messages
17,391
Reaction score
78
Location
In the eternally wet North
Et voila....from Experts Exchange

You could use this macro and assign the shortcut ctrl+S to it:

Public Sub FileSaveAs()
Dim dlg As Dialog
Dim strSaveFolder
strSaveFolder = Application.Options.DefaultFilePath(wdDocumentsPath)
Application.Options.DefaultFilePath(wdDocumentsPath) = "C:\test"
Set dlg = Dialogs(wdDialogFileSaveAs)
dlg.Show
Application.Options.DefaultFilePath(wdDocumentsPath) = strSaveFolder
End Sub

OR

Thinking a bit more about it, you could put this tweaked code in a module in Normal.dot. This would cater for both examples.
You would still have to assign the keystroke shortcut

Public Sub FileSaveAs()
Dim dlg As Dialog
Dim strSaveFolder
strSaveFolder = Application.Options.DefaultFilePath(wdDocumentsPath)
Select Case ActiveDocument.AttachedTemplate.Name
Case "Woodworking.dot"
Application.Options.DefaultFilePath(wdDocumentsPath) = "C:\Woodworking"
Case "Travel.dot"
Application.Options.DefaultFilePath(wdDocumentsPath) = "C:\Travel"
End Select
Set dlg = Dialogs(wdDialogFileSaveAs)
dlg.Show
Application.Options.DefaultFilePath(wdDocumentsPath) = strSaveFolder
End Sub


I've not tried it but it seems to make sense to me
 

Steve Maskery

Established Member
Joined
26 Apr 2004
Messages
11,799
Reaction score
142
Location
Kirkby-in-Ashfield
Excellent Roger, I'll give it a go.
If I put it in Normal.dot, why do I have to asign it to a key? Can't I just call it AutoExec?

Thanks very much.
Cheers
Steve
 

RogerS

Established Member
Joined
20 Feb 2004
Messages
17,391
Reaction score
78
Location
In the eternally wet North
Don't know Steve. I think that the reference to using ctrl-s may have stemmed from the way I worded the original question. Give it a go!

EDIT - actually Steve I have no idea how to put the module into normal.dot so when you've sorted it all out can you tell us what to do please :wink:
 

dedee

Established Member
Joined
24 Jul 2003
Messages
2,637
Reaction score
1
Location
14860, France
Steve, this looks like a sledgehammer to crack a nut. Did you try moving the template to the folder you want to save the document to as I suggested?

Andy
 

RogerS

Established Member
Joined
20 Feb 2004
Messages
17,391
Reaction score
78
Location
In the eternally wet North
Andy

Buit wouldn't that mean that you had to navigate to each respective folder each time you wanted to open a new document?

If so then isn't that the same amount of effort involved in having to navigate to where you want to save the woodwork document or whatever?
 

RogerS

Established Member
Joined
20 Feb 2004
Messages
17,391
Reaction score
78
Location
In the eternally wet North
I wonder if you could create an HTML page that you could open in Word. On the HTML page would be little wee icons of woodworking, travel etc and behind them hyperlinks to your documents?

Bit like what my home page has on it.
 

Steve Maskery

Established Member
Joined
26 Apr 2004
Messages
11,799
Reaction score
142
Location
Kirkby-in-Ashfield
Dedee
I'm with Roger on this point. If I move the template, I'm pretty sure it won't show up in my Templates list, thus defeating the object. :? Sorry.

Roger
Yes I'm pretty sure that would work. Have an icon to save a woody article and another to save an Invoice. I've used icons for macros before so I'm sure that would work. And as I say, I already have the macro working, just not running automatically.

Be nice to get it working automatically though. I might have another play later.

Hppy Saturday
Steve
 

Mike B

Established Member
Joined
21 Mar 2005
Messages
116
Reaction score
0
Location
Brymincham
Steve

The reason fof the ctrl+S was that if you create a subroutine or function you have to have some means of triggering it - in this case ctrl+S seemed obvious as that is the existing keyboard shortcut for "save"...

I think you need something like :

Sub AutoNew()
ChangeFileOpenDirectory "C:\Document path\" - e.g. UnPaid etc
End Sub

Sub AutoOpen()
ChangeFileOpenDirectory "C:\Document path\" - e.g. UnPaid etc
End Sub

or

Private Sub Document_New()
ChangeFileOpenDirectory "C:\Document path\" - e.g. UnPaid etc
End Sub

Private Sub Document_Open()
ChangeFileOpenDirectory "C:\Document path\" - e.g. UnPaid etc
End Sub


Put either in the "Project (ABC) -> Microsoft Word Objects -> thisDocument" dialog in the VBA editor for you template.

Then when you hit "Save" or "Save As" the new directory path should hopefully be shown...

Not sure if you need both the New and Open versions of the subs for templates as I think you always have to use New to invoke a doc from a template, but it won't hurt.

Cheers
Mike
 

engineer one

Established Member
Joined
25 May 2005
Messages
3,070
Reaction score
0
Location
Wembley, Middx
i was taught years ago not to save within the programme.

i also do not save in my docs, since viruses tend to search for those and try to eat them up.

so when in your desk top, right click the mouse, set up a new folder, and name it what you want, then in word just use save as, simple.

or am i as usual missing the point??? :lol: :lol:
paul :wink:
 
Top