Save as Macro not working when opening attachment from Outlook

M

Martin

Hi,

I've got the following macro:

Sub DocSave()

Dim dlgSaveAs As Object

Dim ePath As String

ChangeFileOpenDirectory "C:\Data\Email\"

Set dlgSaveAs = Dialogs(wdDialogFileSaveAs)

dlgSaveAs.Show

End Sub



which just opens the save as dialog box but defaults to the folder specified
in ChangeFileOpenDirectory



This works fine in Word directly but if I open a Word attachment from
Outlook and run I get either the Outlook temp files folder (Outlook 2003,
Word 2003) or the original Default save as folder (eg. my docs) (Word 2k7 /
OL2k7)



Am I missing something??



Any ideas would be much appreciated.



martin
 
J

Jean-Guy Marcil

Martin was telling us:
Martin nous racontait que :
Hi,

I've got the following macro:

Sub DocSave()

Dim dlgSaveAs As Object

Dim ePath As String

ChangeFileOpenDirectory "C:\Data\Email\"

Set dlgSaveAs = Dialogs(wdDialogFileSaveAs)

dlgSaveAs.Show

End Sub



which just opens the save as dialog box but defaults to the folder
specified in ChangeFileOpenDirectory



This works fine in Word directly but if I open a Word attachment from
Outlook and run I get either the Outlook temp files folder (Outlook
2003, Word 2003) or the original Default save as folder (eg. my docs)
(Word 2k7 / OL2k7)



Am I missing something??



Any ideas would be much appreciated.

Documents opened directly from Outlook always cause grief when we try to do
more than just have a quick look...
I always tell my clients to never open Documents straight from Outlook, but
to extract them first to some folder, even the desktop will do, and then run
the code I provide.

I am not sure why, but I believe it is similar to documents opened within
IE, they do not behave the same way and code may produce
undesirable/unwanted effects.

--

Salut!
'_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
R

Russ

Martin,

See if this code makes a difference.
Sub DocSave()
Dim myPath as String
Dim dlgSaveAs As Word.Dialog

myPath = Options.DefaultFilePath(wdDocumentsPath)
Options.DefaultFilePath(wdDocumentsPath) = "C:\Data\Email\"

Set dlgSaveAs = Dialogs(wdDialogFileSaveAs)
'dlgSaveAs.Name = "Whatever"
dlgSaveAs.Show

Options.DefaultFilePath(wdDocumentsPath) = myPath
End Sub
 
J

Jean-Guy Marcil

Russ was telling us:
Russ nous racontait que :
Martin,

See if this code makes a difference.
Sub DocSave()
Dim myPath as String
Dim dlgSaveAs As Word.Dialog

myPath = Options.DefaultFilePath(wdDocumentsPath)
Options.DefaultFilePath(wdDocumentsPath) = "C:\Data\Email\"

Set dlgSaveAs = Dialogs(wdDialogFileSaveAs)
'dlgSaveAs.Name = "Whatever"
dlgSaveAs.Show

Options.DefaultFilePath(wdDocumentsPath) = myPath
End Sub

I tried it with Word 2003 with no luck...

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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