+ Reply to Thread
Results 1 to 5 of 5

open-run macro, disable marcos, close email it

  1. #1
    Registered User
    Join Date
    01-21-2011
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    17

    Question open-run macro, disable marcos, close email it

    I need to do this without human intervention:

    Open the Excel - Run a Macro to Refresh the spreadsheets - there is a data connection to MS-Access.

    Somehow?? Then disable the Macro that does the refresh. So the next person that opens the Excel the auto refresh does not happen.

    Then Close the Excel.

    Then send the Excel without the Macro via Outlook to a distribution list.

    Any great ideas would be appreaciated. I get different parts to work but can-not get it all glued together.

    Russ

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: open-run macro, disable marcos, close email it

    Hi,

    When you say autorun when Excel is opened, I'm assuming you mean when the particular workbook is opened not the Application.

    Why not just use a variable that's stored in an xlveryhidden sheet in say a cell named "FirstTime"

    In the Workbook open event make the first instruction

    Please Login or Register  to view this content.
    Set the variable to Yes and save the workbook.
    Now it will run the first time, but any subsequent attempt to open it will immediately close it. If you don't want this nuclear option then perhaps replace the Workbook.Close with an "End" instruction.

    HTH
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    01-21-2011
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: open-run macro, disable marcos, close email it

    Great command - keep with me on this. I will test it and let you know.

    I open the Excel up by an XP-Schedule task.

    This is one strange process, but it will make my boss's boss happy. Which means I stay employed.

    Thx Russ

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: open-run macro, disable marcos, close email it

    OK. I'll be interested to hear how it pans out.

    You might like to make it a little more user friendly by displaying a pop up message box just before the macro closes the workbook.

    Regards

  5. #5
    Registered User
    Join Date
    01-21-2011
    Location
    usa
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: open-run macro, disable marcos, close email it

    No pop-up messages to happen.

    All this is to happen at 9pm at night, by a computer.

    Russ

+ 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