Excel: Trigger double click event

double-clickexcelpassword-protectionvba

I have an Excel workbook that has been password protected by a third party. The interaction in that worksheet is done with double clicks to toggle check marks in fields. I would have to do 7000 double clicks to finish this task, so I would like to automate it. My suspicion is that the worksheet is using the BeforeDoubleClick event. The password encryption hides the actual implementation.

I started out running a test in my own worksheet, without a password, to rule those issues.

I have tried Application.DoubleClick:

Range("B17").Select
Application.DoubleClick

But that doesn't trigger my event code (Worksheet_BeforeDoubleClick), which do work for "real" double clicks.

That is apparently by design according to MS:
http://msdn.microsoft.com/en-us/library/office/aa220809(v=office.11).aspx

The DoubleClick method doesn't cause this event to occur.

I can't call the third party event code directly, since the sub is private. Is there a way around this?

I have tried this both in Excel 2003 and 2007.

Best Answer

Here is workaround that you can try (I tried this on Excel 2007)

  1. Make the BeforeDoubleClick event public (I used this in Sheet1)

    Public Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

  2. In your macro simply call this function

    Range("B17").Select
    Call Sheet1.Worksheet_BeforeDoubleClick(Selection, False)