Incorporate Input Box User Response for Naming of File

R

RPMitchal

Word 2003

I would like to use an Input Box within a procedure that asks the question:
"What would you like to name this file?"

I would additionally like to incorporate and concatenate the user's response
to this question as the file name within the path for saving the document.
I.e., C:\folder name\*User's Response*.doc.

Thanks so much in advance for any assistance in this regard.

Rod
 
J

Jay Freedman

Word 2003

I would like to use an Input Box within a procedure that asks the question:
"What would you like to name this file?"

I would additionally like to incorporate and concatenate the user's response
to this question as the file name within the path for saving the document.
I.e., C:\folder name\*User's Response*.doc.

Thanks so much in advance for any assistance in this regard.

Rod

See http://www.word.mvps.org/FAQs/MacrosVBA/SaveInCertainFolder.htm.
 
R

RPMitchal

Jay:

Thanks so very much. I haven't had a chance yet to put this macro into
practice, but I am absolutely sure that not only will it be of tremendous
assistance, but that it will be yet another step in my on-going commitment
towards not only learning the ins and outs of VBA programming for Word, but
additionally towards understanding and appreciating how it is that you guys
know what you do.

Thanks again - Rod
 
R

RPMitchal

Jay:

Although I copied and have been trying to use the code from the link you
suggested, I find that somehow I am restricted from actually saving the
document and as of yet have not been able to get past...

*MsgBox "documents can't be saved in that folder. Please try again."*

I have tried any number of naming combinations or conventions to get by
whatever restriction exists within the code yet it continues to elude me.

My guess would be that it has everything to do with...

If LCase$(Left$(CurDir, 20)) <> "c:\my documents\test" Then
MsgBox "Documents can't be saved in that folder. Please try
again."
Exit Sub
End If

....and I'm not sure what steps I need to take in naming the file to get
beyond the MsgBox, nor am I sure as to what the purpose of the restrictive
coding might be.

Thanks in advance - yet again - Rod
 
J

Jay Freedman

You're supposed to replace the path in double quotes with the (all lower case)
actual path that you want the document to be saved in; and you replace the 20
with the number of characters in that path. For example, if you wanted the
document to be saved in the folder C:\Temp (which contains 7 characters), then
you would change the line of code to

If LCase$(Left$(CurDir, 7)) <> "c:\temp" Then

The purpose of it is to make sure the user didn't change the path shown in the
dialog to something other than the path to be enforced.
 
R

RPMitchal

Jay:

As you might guess, the miscalculation was on my part, taking the supplied
coding and your additional comments into account, I was able to modify the
coding to do just what I needed.

Thanks so very much for your assistance. I really do appreciate it.

Rod
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top