+ Reply to Thread
Results 1 to 5 of 5

Assign Macro to a Button on Open of Excel File

  1. #1
    Forum Contributor
    Join Date
    11-08-2012
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2010
    Posts
    110

    Assign Macro to a Button on Open of Excel File

    Hi Experts,

    I have an issue that I am not sure how to solve. I need to assign a macro to a Button in my Excel file, BUT, I need to assign when the file opens. I have an issue when the file is closed the button stays on the sheet but the macro gets stripped from the button. So, when the file opens I would like for the macro to get reassigned to the button. Below is what I have tried so far, but I am getting a run time error. Any thoughts or a new method would be greatly appreciated.

    Thanks

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,009

    Re: Assign Macro to a Button on Open of Excel File

    .
    ????

    How is macro "stripped" from the button when the workbook closes ?

  3. #3
    Forum Contributor
    Join Date
    11-08-2012
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: Assign Macro to a Button on Open of Excel File

    Hi Logit,

    Thanks for the reply. If it helps, you can think of it as the button not appearing when the file is opened. The Macro was there when the file was created and saved but when I or someone else goes to open it the button is no longer on the tab. To answer your question the Excel file is going through another program that is dropping the Button with the macro when re-opened.

    Thanks

  4. #4
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    Re: Assign Macro to a Button on Open of Excel File

    "The Excel file is going through another program..."

    Can you elaborate on that?

  5. #5
    Forum Contributor
    Join Date
    11-08-2012
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2010
    Posts
    110

    Re: Assign Macro to a Button on Open of Excel File

    Thanks to everyone for the concern as to why the macro gets removed from the button but I was able to work out a solution to get the button added and the macro re-attached when the file opens and to check to see if the button is already there and not add it a second time. Thanks again everyone.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA assign macro to button from a different file (simple you'd thi
    By NX3 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-02-2014, 01:08 AM
  2. Customize Ribbon (Add Button / Assign Macro) in Excel 2010
    By JMax in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-08-2012, 04:46 PM
  3. Replies: 5
    Last Post: 08-03-2011, 08:39 PM
  4. Macro Button To open PDF File
    By Denzil in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-18-2008, 10:28 AM
  5. [SOLVED] Button assign macro breaks with file name change and appears elsew
    By Student in forum Excel General
    Replies: 2
    Last Post: 07-25-2006, 04:10 PM
  6. [SOLVED] how to create a command button, then assign macro to it in excel
    By kshaheen in forum Excel General
    Replies: 2
    Last Post: 06-05-2005, 11:05 PM
  7. [SOLVED] Button to open excel file
    By Koataus in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-26-2005, 05:19 PM
  8. How to assign a macro to a button in Excel 2003?
    By Mike in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-18-2005, 01:03 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1