Hello everyone, my problem seems to be simple but it is giving me very hard time to resolve.
I have an excel file with "Worksheet_BeforeDoubleClick" event defined in excel vba and this event is automatically called whenever a user double clicks on a cell. The event is working perfectly fine in excel.
But my problem is, I would like to open an excel file through Access VBA and call the event automatically whenever a user double clicks on a cell in the excel.
Well, the following Access VBA code opens an excel file successfully when I run "RunMacro()" proc. But, the proc calls the event only once when I run it.
The code doesn't call the event automatically whenever the user double clicks on a cell!
I am really having very haaaaard time to solve this problem. Its been two weeks I have been working on this problem.
I have also searched internet a loooooot, but I haven't find anything on "handling excel events in access".
Please have mercy on me. Your help/idea will be greatly appreciated. Thanks a hundred billion in advance!
I have an excel file with "Worksheet_BeforeDoubleClick" event defined in excel vba and this event is automatically called whenever a user double clicks on a cell. The event is working perfectly fine in excel.
But my problem is, I would like to open an excel file through Access VBA and call the event automatically whenever a user double clicks on a cell in the excel.
Well, the following Access VBA code opens an excel file successfully when I run "RunMacro()" proc. But, the proc calls the event only once when I run it.
The code doesn't call the event automatically whenever the user double clicks on a cell!
Code:
Sub RunMacro()
Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
Set xlApp = New Excel.Application
With xlApp
.Visible = True
.Interactive = True
Set xlWB = .Workbooks.Open("C:\Books1.xls", , False)
xlWB.Worksheets(1).Activate
Worksheet_BeforeDoubleClick ActiveCell, False
End With
Exit_Routine:
Set xlApp = Nothing
Set xlWB = Nothing
Exit Sub
End Sub
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
MsgBox "Hello!"
End Sub
I have also searched internet a loooooot, but I haven't find anything on "handling excel events in access".
Please have mercy on me. Your help/idea will be greatly appreciated. Thanks a hundred billion in advance!