Microsoft Knowledge Base Email Alertz

(258486) - The sample file VBA Query Events.VSD does not work as it is described on the Visio drawing that the VBA code is attached to. Rather than asking you to confirm deletion of the currently selected objects, you receive the following message:...

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 258486 - Last Review: January 27, 2007 - Revision: 1.3

Visio2000: The VBA Query Events Sample in the DVS Folder of Visio Standard 2000 International English Doesn't Work

This article was previously published under Q258486

SYMPTOMS

The sample file "VBA Query Events.VSD" does not work as it is described on the Visio drawing that the VBA code is attached to. Rather than asking you to confirm deletion of the currently selected objects, you receive the following message:
Selection is about to be deleted.
You can only click OK. You cannot prevent the deletion.

CAUSE

The Document_QueryCancelSelectionDelete function in the sample file does not reference the QuerySelectionDelete event correctly.

RESOLUTION

To work around this behavior, modify the Document_QueryCancelSelectionDelete function as follows:
  • Instead of referencing QuerySelectionDelete, which returns an integer, reference QueryCancelSelectionDelete, which returns a Boolean value.

  • Return FALSE to allow the operation and TRUE to cancel it, which is the opposite of the sample code.
The Document_QueryCancelSelectionDelete function should appear in the code as follows:
Private Function Document_QueryCancelSelectionDelete(ByVal Selection As IVSelection) As Boolean
Dim msgBoxResult As VbMsgBoxResult
Dim bRetVal As Boolean

'Verify user wants to delete
msgBoxResult = MsgBox("Would you like to cancel the deletion?", _
                        vbYesNo, "QuerySelectionDelete Event")

'Check user answer
Select Case msgBoxResult
    Case vbYes
        bRetVal = True
    Case vbNo
        bRetVal = False
    Case Else
        bRetVal = False
End Select

'return value to allow or cancel deletion
Document_QueryCancelSelectionDelete = bRetVal
End Function
				

APPLIES TO
  • Microsoft Visio 2000 Standard Edition
  • Microsoft Visio 2000 Technical Edition
  • Microsoft Visio 2000 Professional Edition
  • Microsoft Visio 2000 Enterprise Edition
Keywords: 
kbbug kbdocerr kbdtacode kbpending KB258486
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate