+ Reply to Thread
Results 1 to 4 of 4

Call a macro from your personal workbook?

Hybrid View

  1. #1
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Call a macro from your personal workbook?

    I need a macro to close a workbook then re open it

    i figure i can do this using a macro from my perosnal.xls. as it will remain open

    any ideas how i'd call that from another workbook or any suggestions on how this is possible?

    cheers
    Last edited by VBA Noob; 05-30-2008 at 08:41 AM.
    Mr MaGoo
    Magoo.Inc MMVII

    If i've helped please add to my Rep by Clicking on the Blue Scales in the top right hand corner of the post

  2. #2
    Registered User
    Join Date
    04-30-2008
    Posts
    14
    put the following code into the ThisWorkbook file that is on the left hand side in VBA with the little excel icon.

    Sub Workbook_Open()

    Workbooks("sample.xls").Activate
    ActiveWorkbook.Close
    Workbooks.Open Filename:="c:\sample.xls"

    End Sub

  3. #3
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    Thumbs up

    cheers

    really no need for the "little excel icon" part lol i know me way around by now lol

    thanks for the help dude!!!! my code was similar to this!!

  4. #4
    Registered User
    Join Date
    04-30-2008
    Posts
    14
    Actually the code that I wrote earlier was a bit specific. It would activate when you open the initial workbook. However, the body of the code is the same if you want to use the procedure in a module.


    Sub ThisModuleClosesAndReopensAnotherWorkbook()

    Workbooks("sample.xls").Activate
    ActiveWorkbook.Close
    Workbooks.Open Filename:="c:\sample.xls"

    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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