Bug in Filedialog(msoFileDialogSaveAs) execute method

R

Ricky

Hi to all,
I made routine in word 2007-VBA for be shure that working document have
saved before user close it. I used Filedialog (msoFileDialogSaveAS), so user
can select the name and path of the file but, when I call the execute method
it doesn't work. Can somebody tell me why?

I take example from MSDN for build the routine.
This is my code:

Dim fd As FileDialog
Dim FN As String

Set fd = Application.FileDialog(msoFileDialogSaveAs)
If fd.Show = -1 Then
fd.Execute '--->this cause the error
End If

This is the error:
Runtime error -2147467259(80004005)
command failed
--
***************************

Ricky
Analista Programmatore
Software Projects
http://www.softwareprojects.it
 
R

Ricky

Hi to All,
I've resolved the problem. It was in caller of file save subroutine. I
controlled "ThisDocument.saved" object property for be sure that the document
was saved from the user before close the file. All routine were in word
template, this caused two ThisDocument object opened when application run and
put in error filedialog execute method. I resolved the problem only changing
"ThisDocument.saved" property with "ActiveDocument.saved". Now execute method
work good.

Thanks to all.
--
***************************

Ricky
Analista Programmatore
Software Projects
http://www.softwareprojects.it
 

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