Knowledge Base

WD6x: InsertFile Command Returns -1 for Both OK and Cancel

Article ID: 139961

Article Last Modified on 11/21/2006


APPLIES TO


This article was previously published under Q139961

SYMPTOMS

The InsertFile command returns -1 for both OK and Cancel. This behavior is incorrect. The command should return 0 for Cancel and -1 for Insert.

WORKAROUND

WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

Use the following macro to work around the problem.
   Sub MAIN
      On Error Goto Canc
      Dim dlg As InsertFile
      GetCurValues dlg
      Dialog dlg
      InsertFile dlg
      MsgBox "OK button pushed, file inserted."
      Goto done
   Canc:
      MsgBox "Cancel button pushed."
   done:
   End Sub
				

STATUS

Microsoft has confirmed this to be a problem in the products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Additional query words: word basic

Keywords: kbbug kbmacro KB139961