Group:  Microsoft Word ยป microsoft.public.word.vba.userforms
Thread: FileDialog SaveAs Doesn't Work ?

FileDialog SaveAs Doesn't Work ?
"Glenn Rose-Ward" <glenn[ at ]4by2.net> 11/2/2008 11:28:28 AM
I'm using the following code in a piece of Word 2007 vba code
The problem is i just ignores my path settings and points the saveas back at
my default documents directory, anyone any ideas what i'm doing wrong please
?
I set the path with

Options.DefaultFilePath(wdDocumentsPath) = strClientsPath

a few lines earlier in the code and have also tried issuing a
ChDir(strClientsPath), still does what it likes :)

Dim dlgSaveAs As FileDialog

Set dlgSaveAs = Application.FileDialog(FileDialogType:=msoFileDialogSaveAs)

dlgSaveAs.InitialFileName = strFileName
dlgSaveAs.InitialView = msoFileDialogViewLargeIcons
dlgSaveAs.Show
dlgSaveAs.Execute

ActiveDocument.Close SaveChanges:=False
Set dlgSaveAs = Nothing

Re: FileDialog SaveAs Doesn't Work ?
Jay Freedman <jay.freedman[ at ]verizon.net> 11/2/2008 3:17:18 PM
On Sun, 2 Nov 2008 11:28:28 -0000, "Glenn Rose-Ward" <glenn[ at ]4by2.net> wrote:

[Quoted Text]
>I'm using the following code in a piece of Word 2007 vba code
>The problem is i just ignores my path settings and points the saveas back at
>my default documents directory, anyone any ideas what i'm doing wrong please
>?
>I set the path with
>
> Options.DefaultFilePath(wdDocumentsPath) = strClientsPath
>
>a few lines earlier in the code and have also tried issuing a
>ChDir(strClientsPath), still does what it likes :)
>
>Dim dlgSaveAs As FileDialog
>
>Set dlgSaveAs = Application.FileDialog(FileDialogType:=msoFileDialogSaveAs)
>
>dlgSaveAs.InitialFileName = strFileName
>dlgSaveAs.InitialView = msoFileDialogViewLargeIcons
>dlgSaveAs.Show
>dlgSaveAs.Execute
>
>ActiveDocument.Close SaveChanges:=False
>Set dlgSaveAs = Nothing

Forget about changing the default path, and stuff the path into the
..InitialFileName property of the dialog:

dlgSaveAs.InitialFileName = strClientsPath & "\" & strFileName


--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
Re: FileDialog SaveAs Doesn't Work ?
"Glenn Rose-Ward" <glenn at 4by2.net> 11/12/2008 9:57:08 PM
Thanks Jay that worked !

"Jay Freedman" <jay.freedman[ at ]verizon.net> wrote in message
news:k1hrg45230datssjhvg5621h8pkct7nfjh[ at ]4ax.com...
[Quoted Text]
> On Sun, 2 Nov 2008 11:28:28 -0000, "Glenn Rose-Ward" <glenn[ at ]4by2.net>
> wrote:
>
>>I'm using the following code in a piece of Word 2007 vba code
>>The problem is i just ignores my path settings and points the saveas back
>>at
>>my default documents directory, anyone any ideas what i'm doing wrong
>>please
>>?
>>I set the path with
>>
>> Options.DefaultFilePath(wdDocumentsPath) = strClientsPath
>>
>>a few lines earlier in the code and have also tried issuing a
>>ChDir(strClientsPath), still does what it likes :)
>>
>>Dim dlgSaveAs As FileDialog
>>
>>Set dlgSaveAs =
>>Application.FileDialog(FileDialogType:=msoFileDialogSaveAs)
>>
>>dlgSaveAs.InitialFileName = strFileName
>>dlgSaveAs.InitialView = msoFileDialogViewLargeIcons
>>dlgSaveAs.Show
>>dlgSaveAs.Execute
>>
>>ActiveDocument.Close SaveChanges:=False
>>Set dlgSaveAs = Nothing
>
> Forget about changing the default path, and stuff the path into the
> .InitialFileName property of the dialog:
>
> dlgSaveAs.InitialFileName = strClientsPath & "\" & strFileName
>
>
> --
> Regards,
> Jay Freedman
> Microsoft Word MVP FAQ: http://word.mvps.org
> Email cannot be acknowledged; please post all follow-ups to the newsgroup
> so all may benefit.

Home | Search | Terms | Imprint
Newsgroups Reader