+ Reply to Thread
Results 1 to 9 of 9

Avoid calling the file where the code si saved

  1. #1
    Forum Contributor
    Join Date
    05-29-2014
    MS-Off Ver
    Office 2013
    Posts
    115

    Avoid calling the file where the code si saved

    Hi everybody,

    I am using a button in ribbon to link the excel document with a macro code.
    What i did was; i save the macro code in one excel document so when I click the button that i created on Ribbon, the file that I am using, call the file where the code is saved.

    The button(that i already created) is going to open the file where the vba code is saved.
    Since the time is substantial, also the file is too big, to avoid freezing; I was wondering if there is any option to don't call the all file but just the code.
    For example i want to do something like "copy" or Paste. when you click this buttons nothing need to be open besides the file that you are working. I wanted to do the same thing with my macro.

    Any ideas ?

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Avoid calling the file where the code si saved

    I always have my code book open, it needn't be the active book.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Avoid calling the file where the code si saved

    Have you ever made use of your personal workbook?

    Select developer, macros, start recorder, select "In Personal Workbook", enter a letter like g that will run the macro.

    record a small macro, stop the recorder.

    Now whatever sheet you are in. pressing ctrl and g will run that macro

  4. #4
    Forum Contributor
    Join Date
    05-29-2014
    MS-Off Ver
    Office 2013
    Posts
    115

    Re: Avoid calling the file where the code si saved

    Quote Originally Posted by mehmetcik View Post
    Have you ever made use of your personal workbook?

    Select developer, macros, start recorder, select "In Personal Workbook", enter a letter like g that will run the macro.

    record a small macro, stop the recorder.

    Now whatever sheet you are in. pressing ctrl and g will run that macro
    Thank you mehmetcik but my idea was to use one button on Ribbon. Do you have any idea for that?

  5. #5
    Registered User
    Join Date
    04-25-2014
    Location
    NYC, NY
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: Avoid calling the file where the code si saved

    To have one button on the ribbon that works on all workbooks, you should place it in the Personal Workbook. Do not put any data inside the personal workbook, and just store your macros there. Hide the personal workbook so that the macros will always be readily available but will not show up and disrupt you.

  6. #6
    Forum Contributor
    Join Date
    05-29-2014
    MS-Off Ver
    Office 2013
    Posts
    115

    Re: Avoid calling the file where the code si saved

    Quote Originally Posted by jhuang5132 View Post
    To have one button on the ribbon that works on all workbooks, you should place it in the Personal Workbook. Do not put any data inside the personal workbook, and just store your macros there. Hide the personal workbook so that the macros will always be readily available but will not show up and disrupt you.
    I am trying but i said "cannot edit a macro on a hidden workbook.Unhide the workbook using the unhide command"
    I don't know why it shows me this, I just click the excel icon

  7. #7
    Forum Contributor
    Join Date
    05-29-2014
    MS-Off Ver
    Office 2013
    Posts
    115

    Re: Avoid calling the file where the code si saved

    Quote Originally Posted by jhuang5132 View Post
    To have one button on the ribbon that works on all workbooks, you should place it in the Personal Workbook. Do not put any data inside the personal workbook, and just store your macros there. Hide the personal workbook so that the macros will always be readily available but will not show up and disrupt you.
    I am trying but it said "cannot edit a macro on a hidden workbook.Unhide the workbook using the unhide command"
    I don't know why it shows me this, I just click the excel icon

  8. #8
    Registered User
    Join Date
    04-25-2014
    Location
    NYC, NY
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: Avoid calling the file where the code si saved

    To edit the macro, you need to unhide it.

    I do believe that another way is to insert a new module, paste the code you have, and then exit out of the personal workbook, while saving all changes. Then you can hide the workbook. After that, when you want to edit your macro, go to Macros, select your macro, and Step-Into it. After you edit, press the save icon at the top.

    The hidden personal workbook should still be able to run as it is hidden in the background.

  9. #9
    Forum Contributor
    Join Date
    05-29-2014
    MS-Off Ver
    Office 2013
    Posts
    115

    Re: Avoid calling the file where the code si saved

    Quote Originally Posted by jhuang5132 View Post
    To edit the macro, you need to unhide it.

    I do believe that another way is to insert a new module, paste the code you have, and then exit out of the personal workbook, while saving all changes. Then you can hide the workbook. After that, when you want to edit your macro, go to Macros, select your macro, and Step-Into it. After you edit, press the save icon at the top.

    The hidden personal workbook should still be able to run as it is hidden in the background.
    Thanks for your help jhuang5132

+ 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] Code optimization to avoid multiple file open calls
    By smpita in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-28-2014, 01:31 PM
  2. Avoid changes of text properties when calling Shapes().Formula
    By EseKuent in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2009, 02:31 AM
  3. Very weird - Code does not work until after file is saved???
    By InfiniteJoy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-29-2006, 04:29 PM
  4. Running code before any file is opened/saved
    By Bill Schanks in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2006, 01:10 PM
  5. [SOLVED] Hyperlink Code only works when file saved on desktop
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2005, 03:05 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