+ Reply to Thread
Results 1 to 19 of 19

Program Macro To Work On A Certain Workbook

  1. #1
    Registered User
    Join Date
    04-05-2012
    Location
    uk
    MS-Off Ver
    Excel 07
    Posts
    77

    Program Macro To Work On A Certain Workbook

    Hi I have a workbook called Dec2012 I was wondering if anyone could help me as to where I put the workbook name in the code so I can open other workbooks and use them normally without the macro upsetting them .

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Program Macro To Work On A Certain Workbook

    Does the code reside in Dec2012 or in another workbook?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    04-05-2012
    Location
    uk
    MS-Off Ver
    Excel 07
    Posts
    77

    Re: Program Macro To Work On A Certain Workbook

    ITS IN DEC2012 I HAVE A SAVE MACRO ON AUTO_OPEN WOULD I JUST PUT Application.Run "'DEC2012.xlsm'!Save" OR DO I HAVE TO WRITE THE FILE NAME INTO THE MACRO TOO ?

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Program Macro To Work On A Certain Workbook

    Can you post your code here please?

  5. #5
    Registered User
    Join Date
    04-05-2012
    Location
    uk
    MS-Off Ver
    Excel 07
    Posts
    77

    Re: Program Macro To Work On A Certain Workbook

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Program Macro To Work On A Certain Workbook

    rjm87,

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature below this post.

  7. #7
    Registered User
    Join Date
    04-05-2012
    Location
    uk
    MS-Off Ver
    Excel 07
    Posts
    77

    Re: Program Macro To Work On A Certain Workbook

    Oops Sorry , Ill know for again

  8. #8
    Registered User
    Join Date
    04-05-2012
    Location
    uk
    MS-Off Ver
    Excel 07
    Posts
    77

    Re: Program Macro To Work On A Certain Workbook

    Will this save all open workbooks or just DEC12 ?

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Program Macro To Work On A Certain Workbook

    I have only added code tags to your post, i have not posted any solution yet. Working on it.

  10. #10
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Program Macro To Work On A Certain Workbook

    Just change ActiveWorkbook to ThisWorkbook.

    I'm pretty sure that you don't need a macro for this, I think that excel will auto-save every so often if you configure it like that - though I haven't used Excel 97 for a very long time.

  11. #11
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Program Macro To Work On A Certain Workbook

    What are you trying to achieve? You want to open the file and then have it save every 15 mins?

  12. #12
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Program Macro To Work On A Certain Workbook

    Thats what i wanted to tell the OP to change activeworkbook to thisworkbook. But i too havent worked on Excel 97 since ages so am not sure whether any other part too needs to be changed.

  13. #13
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Program Macro To Work On A Certain Workbook

    Actually I bet the OP hasn't either going on his filename

  14. #14
    Registered User
    Join Date
    04-05-2012
    Location
    uk
    MS-Off Ver
    Excel 07
    Posts
    77

    Re: Program Macro To Work On A Certain Workbook

    Its excel 2007 im using now , it was an example of one of the macros i was using i am looking to know if there is a way to put the workbookname into the macro so it only runs in dec12

  15. #15
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Program Macro To Work On A Certain Workbook

    Did you try what Kyle suggested?

  16. #16
    Registered User
    Join Date
    04-05-2012
    Location
    uk
    MS-Off Ver
    Excel 07
    Posts
    77

    Re: Program Macro To Work On A Certain Workbook

    How would i add this into another macro ?

  17. #17
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Program Macro To Work On A Certain Workbook

    You don't, it goes into your existing macro

  18. #18
    Registered User
    Join Date
    04-05-2012
    Location
    uk
    MS-Off Ver
    Excel 07
    Posts
    77

    Re: Program Macro To Work On A Certain Workbook

    How do i get the macro to work by the filename ?

  19. #19
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Program Macro To Work On A Certain Workbook

    I've told you, to make it operate on only that workbook, change ActiveWorkbook, to ThisWorkbook in your code

+ 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