

- #EXCEL VBA GET ACTIVEX BUTTON FROM ANOTHER SHEET HOW TO#
- #EXCEL VBA GET ACTIVEX BUTTON FROM ANOTHER SHEET CODE#
- #EXCEL VBA GET ACTIVEX BUTTON FROM ANOTHER SHEET WINDOWS#
'Row 4 is where individual location-based buttons reside.
#EXCEL VBA GET ACTIVEX BUTTON FROM ANOTHER SHEET WINDOWS#
Create 3 more Windows and 3 more Linux systems. 'create 6 columns with 3 Windows and 3 Linux systems as rows. (And I haven't worked with Telnet in YEARS! This is included to show how different devices can have the same function performed on them.)
#EXCEL VBA GET ACTIVEX BUTTON FROM ANOTHER SHEET CODE#
This code is untested as it was modified from another macro that IS tested and working. But it runs them all from the location of the "Run All" button, which is quite useless as there are no IPs below

'Application.Run (ActiveSheet.Cells(ActiveSheet.Buttons(Application.Caller).TopLeftCell.Row + 1, ActiveSheet.Buttons(Application.Caller).TopLeftCell.Column).Activate) 'Run Application.Caller '(ActiveSheet.Cells(ActiveSheet.Buttons(Application.Caller).TopLeftCell.Row - 2, ActiveSheet.Buttons(Application.Caller).TopLeftCell.Column + 2).Activate) ' Next obj- Object variable or With block variable not set. 'Application.Run (ActiveSheet.Cells(ActiveSheet.Buttons(Application.Caller).TopLeftCell.Row - 2, ActiveSheet.Buttons(Application.Caller).TopLeftCell.Column + 2).Activate) - this activates the cell the button is in. The macro may not be available in this workbook. 'Run Application.Caller(ActiveSheet.Cells(ActiveSheet.Buttons(Application.Caller).TopLeftCell.Row - 2, ActiveSheet.Buttons(Application.Caller).TopLeftCell.Column + 2).Activate) - Cannot run the macro 'Button 8'. 'Call Button1_Click - Compile Error: Sub or function not defined

'End With - Compile Error: With object must be user-defined type, Object, or Variant (This *isn't* an object?) 'Worksheet("TCP").OLEObjects("HC").Click - Compile Error: Sub or function not defined 'Button3Macro - Compile Error: Sub or function not defined As I have hundreds of buttons and few macros, I need to "press" the button. Note that the difference between the two is plink and telnet. Shell ("C:\Windows\System32\cmd.exe /k cd c:\&telnet" & " " & ActiveSheet.Cells(ActiveSheet.Buttons(Application.Caller).TopLeftCell.Row + 8, ActiveSheet.Buttons(Application.Caller).TopLeftCell.Column).Value & " -l " & Range("A11") & "\" & ActiveSheet.Cells(ActiveSheet.Buttons(Application.Caller).TopLeftCell.Row - 1, ActiveSheet.Buttons(Application.Caller).TopLeftCell.Column).Value & "_" & Format(Now, "MM-DD-YYYY_hh-mm-ss") & "_uptime.txt&exit") & " -pw " & Range("A13") & " " & """ping 127.0.0.1""" & " > c:\pingtest\" & Range("A1") & "\" & ActiveSheet.Cells(ActiveSheet.Buttons(Application.Caller).TopLeftCell.Row + 7, ActiveSheet.Buttons(Application.Caller).TopLeftCell.Column).Value Shell ("C:\Windows\System32\cmd.exe /k cd c:\&plink" & " " & ActiveSheet.Cells(ActiveSheet.Buttons(Application.Caller).TopLeftCell.Row + 8, ActiveSheet.Buttons(Application.Caller).TopLeftCell.Column).Value & " -l " & Range("A11") I assign the Windows macro to 8 buttons and the Linux Macro to 6 buttons.

Sheets("Sheet11").Shapes("CommandButton1").Lets say I have two types of devices that need a ping test run from. Here Delete is the property of Shape object. In the below example, its deleting the command button named ‘CommandButton1’ which is on the worksheet named ‘Sheet11’.
#EXCEL VBA GET ACTIVEX BUTTON FROM ANOTHER SHEET HOW TO#
Please find the below code, it will show you how to delete or remove a command button on the worksheet. It is shown in the following Screen Shot.ĭelete CommandButton Control on the Worksheet using VBA
