Sub FileSaveAs()
Dim saveDialog As FileDialog
Dim path As String
path = GetPath 'Determine where to save the document
Set saveDialog = Dialogs(wdDialogFileSaveAs)
saveDialog.Name = path & ActiveDocument.Name
saveDialog.Display
End Sub
I am now going to have to write five more routines which set the
appropriate file extension on the saveDialog.Name property.
So finally, my question is... it there a better way to tackle this
problem? All I want to do is intercept the save as prompt and set the
path, then let Word carry on as normal.
All suggestions/comments gratefully received!
Dave
It seems I can only intercept the FileSaveAsOtherFormats and
FileSaveAs commands! If I declare the other FileSaveAs* sub routines
in my .dot (or .dotm) they don't get fired!
Dave
Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed
"roadz" <david...@aimlegal.com> wrote in message
news:1170416992.6...@k78g2000cwa.googlegroups.com:
Thanks for your comment.
I am slowly coming to the conclusion that I might as well rewrite my
AddIn for Word 2007 using Visual Studio Tools for Office. This way I
should end up with a much more neat and future proof solution (albeit
one that will only work in Office 2007).
If I am going for a rewrite then I think that a better solution to my
problem is to intercept the DocumentBeforeSave event and use the
ChangeFileOpenDirectory to set the path. However, I need to do a
similar thing with FileOpen so repurpopsing the FileOpen command seems
to be a good idea. I've created a new Word 2007 addin using VSTO 2005
SE and repurposed the command and it works perfectly! I can even slip
in my ChangeFileOpenDirectory command and let Word show the open
dialog itself!
For information, here is my RibbonX and my callback function.
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
onLoad="OnLoad">
<commands>
<command idMso="FileOpen" onAction="OnFileOpen"/>
</commands>
</customUI>
public void OnFileOpen(Office.IRibbonControl control, ref bool
CancelDefault)
{
string path = GetPath(); // Ask the user a question to
determine the path
if (path!="")
{
addin.Application.ChangeFileOpenDirectory(path);
}
CancelDefault = false; // Do NOT cancel the default behaviour
}
Dave
Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed
"roadz" <david...@aimlegal.com> wrote in message
news:1170681942.2...@h3g2000cwc.googlegroups.com:
Can you tell me why??