shoheiyuna
New Member
- Joined
- Dec 3, 2023
- Messages
- 5
- Office Version
- 365
- Platform
- Windows
Hi, I have an Excel macro workbook (wb2) that has been password protected (entire workbook including its macros are protected) by a 3rd party which contains a button in a specific cell that I need to double click on it. This Excel workbook is an unsaved workbook that I have to open via a macro ribbon everytime I run it. (It's actually GLWand)
I've written a macro in a separate Workbook (wb1) to fill in the parameters required in wb1, what I can't figure out is the code to double click the button.
In wb1.Sheet1, I've included the public sub:
In wb1 Module, this is my code. It's not great as I'm still new to macro, but everything so far works up till second last line to select cell F39 in wb2 which contains the button. But I can't seem to activate the doubleclick on it. The doubleclick will allow the macro in wb2 to run. I can't call the macro in wb2 because it's password protected. Really appreciate all help on this, thank you!
I've written a macro in a separate Workbook (wb1) to fill in the parameters required in wb1, what I can't figure out is the code to double click the button.
In wb1.Sheet1, I've included the public sub:
VBA Code:
Public Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
End Sub
In wb1 Module, this is my code. It's not great as I'm still new to macro, but everything so far works up till second last line to select cell F39 in wb2 which contains the button. But I can't seem to activate the doubleclick on it. The doubleclick will allow the macro in wb2 to run. I can't call the macro in wb2 because it's password protected. Really appreciate all help on this, thank you!
VBA Code:
Sub GLWand_1()
'
' GLWand_1 Macro
'
Dim wb As Workbook
Set wb = Workbooks("Setup.xlsm")
Dim wb2 As Workbook
Set wb2 = Workbooks(2)
Dim ws As Worksheet
Set ws = wb.Sheets("Parameters")
Dim ws2 As Worksheet
Set ws2 = wb2.Sheets("Criteria")
ws2.Cells(7, 4) = ws.Cells(4, 3)
ws2.Cells(8, 4) = ws.Cells(5, 3)
ws2.Cells(9, 4) = ws.Cells(6, 3)
ws2.Cells(14, 4) = ws.Cells(8, 3)
ws2.Cells(15, 4) = ws.Cells(9, 3)
ws2.Cells(16, 4) = ws.Cells(10, 3)
ws2.Cells(17, 4) = ws.Cells(11, 3)
ws2.Cells(18, 4) = ws.Cells(12, 3)
ws2.Cells(19, 4) = ws.Cells(13, 3)
ws2.Cells(20, 4) = ws.Cells(14, 3)
ws2.Cells(35, 4) = ws.Cells(15, 3)
ws2.Activate
Range("F39").Select
Call Sheet1.Worksheet_BeforeDoubleClick(Selection, False)
End Sub