Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8755085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:46:35+00:00 2026-06-13T13:46:35+00:00

I have a workbook Wbk1 where a sheet has an ActiveX button. I want

  • 0

I have a workbook Wbk1 where a sheet has an ActiveX button. I want to run the button’s associated Sub from another workbook,Wbk2. It’s not practical to just copy the Sub’s code into Wbk2 because it in turn calls a bunch of functions from Wbk1. I tried the following:

Sub pushButton()

Dim obj As OLEObject
Dim btn As MSForms.CommandButton

For Each obj In Wkb1.Sheets("testSheet").OLEObjects
  If TypeOf obj.Object Is MSForms.CommandButton Then
    set btn=obj.Object
    debug.print btn.Caption 'used to test whether or not For loop is picking up button
    obj.Activate
    SendKeys " "
  End If
Next

End Sub

It’s not only an inelegant SendKeys() hack, but it doesn’t work; the button gets focus but it doesn’t get pushed. I know that the For loop is correctly iterating through the objects, including the CommandButton, because I can pick up the caption for the button. How can I click on this button (and thereby run its private Sub) from Wbk2?

EDIT: The actual filename in question is in the format 123A_1.0-2.0.xlsm. I think the periods are causing some trouble with regard to the solutions posted in comments and responses below, because when I remove the periods these techniques are successful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:46:36+00:00Added an answer on June 13, 2026 at 1:46 pm

    How about just

    Application.Run (wb1.Name & "!MacroName")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a workbook,which contains ActiveX control button and form control button and macros
Ah, another Excel not releasing post on SO..... I have an Excel workbook which
I currently have a excel workbook that has values being pulled from other workbooks
I have data in one sheet in a workbook. I want to distribute it
I have a workbook (wkbk1) that has a sheet with eight different query tables
I have a workbook that has many checkboxes (form control) on one tab. I
I have an excel workbook which needs to query data from an HTTP server.
We have an Excel workbook with a number of ActiveX controls, running in Excel
I have an Excel workbook that I want to use as a template. It
I have an Excel Workbook that has several worksheets in it. The tables in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.