no prompt to save when opening docs through shellexecute

C

captainido

Our VB6 application opens up Word documents using the following code:

lRet = ShellExecute(GetDesktopWindow(), sOperation, sFile, sArgs,
sDirectory, sShowCMD)

where...
GetDesktopWindow = Windows API function that returns a handle to the
desktop window
sOperation = "open"
sArgs = ""
sDirectory = vbNullString
sShowCMD = SW_SHOW = 5

every once in a while, when we open a document using this code, Word
opens up with the following problems:
1. if we make any changes and close the document, Word does not prompt
us to save.
2. Most dialogs don't open: properties, save as, etc. The Templates
dialog does open for some reason.

After this happens once, any other document opened through our program
will open the same way. However, if we open any document (including the
one that caused the problem) directly from explorer - everything works
fine.

After the problems occurs once, we can only stop it by exiting our
application and re-starting it.
We are not sure yet since we could not reproduce the problem, but it
MAY be happening only with documents whose Document Template is
missing.

Any help would be most appreciated!
 

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