save dialog box change

C

craigo

im trying to figure out how to stop users using the drive
drop downbox when they go to save a new doc.

I figured on a vb script or macro that will as a user what
the file name is and save it to a pre-determined folder on
a drive. My aim is to stop the user seeing the save as box.

Am i making sence? lol.. i have some macro knowlage and
very little vb knowlage.. is this possible?

thanks in advance
 
D

Doug Robbins - Word MVP

HI Craigo,

If you create macros with the names of Word's in-build commands FileSave and
FileSaveAs that contain an input box in which you display the filename if
the document has already been saved or into which the user will enter the
new filename, you can then have the code in the macro save the document to a
pre-determined folder.

The code would be

Dim docname As String, Message As String
If InStr(ActiveDocument.FullName, "\") > 0 Then
docname = ActiveDocument.Name
Else
docname = ""
End If
Message = "Enter the name under which you want to save this document"
Message = Message & " or accept the name shown below."

docname = InputBox(Message, "File Save", docname)
ActiveDocument.SaveAs "Drive:\Path\" & docname

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
N

Newbie

Hello, all! I am seeking a twist here--sort of different
from Craigo's purpose. Using either of the suggested
codes, when a user clicks on Cancel, "error 5152" popped
up. What code should I add so that when the Cancel button
is clicked, the user will be prompted to proceed to the
built-in Save As... dialog or do nothing--just return to
the document? Can this be done without the use of
userform?

Also, is it possible with the above codes to add
automatic versioning or numbering of an already-saved
document to prevent accidental overwriting (say
MyMenu.doc becomes MyMenu2.doc)?
 
D

Doug Robbins - Word MVP

Hi Newbie,

Replace the last two lines of my code with

docname = InputBox(Message, "File Save", docname)
If docname = "" Then
Exit Sub
Else
ActiveDocument.SaveAs "Drive:\Path\" & docname
End If

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

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