PDA

View Full Version : Solved: Call the sheets double click event in another workbook



frank_m
10-18-2011, 07:44 AM
I'm wondering if I can call a Sheets double click event in Book2 from Book1

This will be part of a procedure I'm writing that copies a cell value from Sheet1 in Book1 to Sheet1 in Book2, then needs to fire the Book2 Sheet1 double click event.

Thanks

Bob Phillips
10-18-2011, 08:13 AM
The difficulty is not so much in calling a worksheet event in another workbook Frank, that is quite straight-forward as with activate


Application.Run "Book1!Sheet1.Worksheet_Activate"


but more in passing a range object to a procedure via Application.Run, which BeforeDoubleClick requires. I don't think you can do that.

frank_m
10-18-2011, 08:38 AM
Oh ok. - doubclicking the cell manualy will be ok, so I'll abandon that idea.

Thanks for your insight Bob

Aflatoon
10-19-2011, 12:53 AM
Since the Target is passed ByVal, you can in fact do that:

Dim bCancel as boolean
Application.Run "Book1!Sheet1.worksheet_beforedoubleclick", Workbooks("Book1").Sheets("Sheet1").Range("A2"), bCancel

frank_m
10-19-2011, 02:20 AM
Awesome :bow: - I just needed to change Book1 to Book1.xls in your code and it works like a champ.

Thanks Aflatoon