Solved

Can I force Word 2007 "Save As" to the default file location?

Posted on 2009-04-03
4
830 Views
Last Modified: 2012-05-06
Is there a way to force Word 2007, when doing a "Save As", to go to the "default file location" that we specified in the Word options?

It appears Word 2007 tries to go to the same location from which the file came when doing a "Save As" which could be something different.

We have a Web server running IIS 6.0 that hosts some Word files that are read only.  When we open a file in the browser, it starts up Word and opens it just fine.  However, when we do a "Save As" a window pops up for user credentials so it can save it back on the Web server.  If we cancel that window, then the "Save As" window goes to our "default file location".

I want to force it to the default location to eliminate the pop up window.  

Note:  This does NOT happen with our older version of Word XP (2002).
0
Comment
Question by:PMRTech
  • 3
4 Comments
 
LVL 4

Expert Comment

by:Xcone
ID: 24066561
There's no way to force it using the settings of Word. But you can do it using a Macro. See the attached code.

This code should be part of an Word-template (*.Dot) and must me loaded as an addin. The easiest way to do that, is to find the Word Startup folder and add the template in that folder. It will load as an addin automaticly when Word starts. Open de VBA macro editor (Tools > Macro > Editor / or press Alt + F11). Find your template, in the treeview and add a module. Add the attached code in this module and save it. Make sure you replace "<MyDefaultLocation>" with the filefolder you wish to save as default.
Sub FileSaveAs()

  ShowSaveDialog "<MyDefaultLocation>"

End Sub
 

Function ShowSaveDialog(Optional ByVal AFileName As String = "") As Boolean

  Dim d As Dialog

  

  Set d = Dialogs(wdDialogFileSaveAs)

  d.Name = AFileName

  

  On Error GoTo Except

  ShowSaveDialog = (d.Show = -1)

  

  Exit Function

Except:

  MsgBox Err.Description, vbExclamation

End Function

Open in new window

0
 
LVL 4

Expert Comment

by:Xcone
ID: 24066579
I'm sorry, I forgot to mention how it works. The macro called "FileSaveAs" is recognized by Word as an overload. So instead of calling the default SaveAs of Word, the macro "FileSaveAs" will be called instead. So no other steps are required, other then making this macro available in a public module of an addin.
0
 
LVL 4

Accepted Solution

by:
Xcone earned 250 total points
ID: 24066611
You can also try this attached code. It's the same, except that it will use the default location specified at Office Button > Word Options > Save > Default file location. I occured te me later it was this feature u asked for in the 1st place :)
Sub FileSaveAs()

  ShowSaveDialog Application.Options.DefaultFilePath(wdDocumentsPath)

End Sub

 

Function ShowSaveDialog(Optional ByVal AFileName As String = "") As Boolean

  Dim d As Dialog

  

  Set d = Dialogs(wdDialogFileSaveAs)

  d.Name = AFileName

  

  On Error GoTo Except

  ShowSaveDialog = (d.Show = -1)

  

  Exit Function

Except:

  MsgBox Err.Description, vbExclamation

End Function

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem with Window 10 and MS Word 2016 Vertical Bracket List 6 35
Word 2013/2016 Saving as Temp File 9 44
Regarding Notepad++ 4 35
Excel copy picture into Outlook email 7 45
Do you ever need to create a 20 page Word document for some testing purpose? Are you tired of copying & pasting old boring "lorem ipsum" text over and over again, increasing font size and line space in order to make the document 20+ pages long? Look…
Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now