PDA

View Full Version : Toolbar button



Joyce Jung
05-24-2005, 09:12 PM
Using Word 2002 (Windows XP)

1. Is there any way in Word to add a button to a toolbar that opens a specified folder?

2. Also, is there a way to save a file to a particular folder using a macro or toolbar command (or something else)? I tried to create a macro but "got stuck" when the folder opened and I tried to insert a pause command (to insert a filename). I normally use WordPerfect so not sure what can and can't be done in Word.

THANKS FOR ANY HELP!

MOS MASTER
05-25-2005, 10:29 AM
Using Word 2002 (Windows XP)

1. Is there any way in Word to add a button to a toolbar that opens a specified folder?
Hi and Welcome to VBAX! :hi:

What do you mean whit open a specified folder?
Do you want to open a Explorer (Windows) window with that particular path?



2. Also, is there a way to save a file to a particular folder using a macro or toolbar command (or something else)? I tried to create a macro but "got stuck" when the folder opened and I tried to insert a pause command (to insert a filename). I normally use WordPerfect so not sure what can and can't be done in Word.

THANKS FOR ANY HELP!
This Part is why I asked the first question!

It seams to me that you want to press a button that will open a SaveDialog and when you enter the name in it you want the activedocument to be saved to that path.

Am I correct.
If so this possible.

So could you confirm or rephrase your question? :whistle:

Joyce Jung
05-25-2005, 11:18 AM
Using Word 2002 (Windows XP)

1. Is there any way in Word to add a button to a toolbar that opens a specified folder?

2. Also, is there a way to save a file to a particular folder using a macro or toolbar command (or something else)? I tried to create a macro but "got stuck" when the folder opened and I tried to insert a pause command (to insert a filename). I normally use WordPerfect so not sure what can and can't be done in Word.

THANKS FOR ANY HELP!


Re question 1: I am trying to create a button on a toolbar that will open a subfolder of MyDocuments. I hope I am explaining this OK. (Have done this in WordPerfect, but not sure if I can do the same thing in Word)

MOS MASTER
05-25-2005, 11:22 AM
Hi, :D

I understand you want to open that folder but don't understand how you wish to use it.

So must this be part of a filesave macro? Like:

Press button
Diallog pop-up in specific folder
You enter a name press enter
File get's saved in that folder by that name
OR: You just want an explorer screen open with a specific folder view and you just want to look at it?

So try to give me more detail because I'm not understanding it. :rofl:

Joyce Jung
05-25-2005, 05:05 PM
What you describe as a "filesave macro" to a specific folder is what I am looking for.

Hope I explained this OK.

MOS MASTER
05-26-2005, 09:40 AM
What you describe as a "filesave macro" to a specific folder is what I am looking for.

Hope I explained this OK.
Hi Joyce, :yes

Sure I've got it now...I think you want something like this:
Option Explicit

'Change the file path to the folder you want to start the dialog in!
Const sRoot As String = "C:\Documents and Settings\"

Sub SaveMyFile()
Dim dlgSave As Dialog
Application.ChangeFileOpenDirectory Path:=sRoot
Set dlgSave = Dialogs(wdDialogFileSaveAs)

With dlgSave
.Name = sRoot
If .Display = -1 Then
If .Name <> "" Then
ActiveDocument.SaveAs FileName:=.Name
End If
End If
End With

Set dlgSave = Nothing
End Sub


Copy in a new codemodule and press ALT+F8 to execute the sub from within Word.

Enjoy! :whistle: