Forum Discussion

Brandon Lam's avatar
Brandon Lam
Copper Contributor
Mar 13, 2018

Assign a macro to a button

Wondering if someone can help me on this. I have a macro which works perfectly fine when manually triggered or assigning a shortcut key to run it. However, for some strange reason, when i assign the macro to a form control button, the macro does something strange.

The macro is quite complicated but in essence what is meant to do is to save 2 tabs into .txt format. When running the macro from the button, it swaps the names of the 2 files. so fileA.txt has tab B content while fileB.txt has tab A content.

Tried searching around to no avail. Please help. A million Thanks! 

6 Replies

  • Haytham Amairah's avatar
    Haytham Amairah
    Silver Contributor

    Hi Brandon,

     

    To figure out how to help you, we have to see that macro.

    Also, we have to know the structure of the workbook, how many sheets in it, and where you put the button?

     

    Please save the workbook as .xls format, and upload it here in a reply.

    Why .xls?

    As the community policy, .xlsm isn't allowed to be uploaded!

      • Haytham Amairah's avatar
        Haytham Amairah
        Silver Contributor

        Hi Brandon,

         

         

        The macro isn't found in this workbook!
        It seems it saved in another workbook such as Personal Macro Workbook.

Resources