+ Reply to Thread
Results 1 to 5 of 5

Edit File Manually while Macro is running.

  1. #1
    Registered User
    Join Date
    11-29-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2010
    Posts
    8

    Unhappy Edit File Manually while Macro is running.

    Hi All,

    I am opening an excel file( say Test.xls), editing it and then closing it through a macro.

    The problem is that i have to pause a macro untill I complete the editing in Test.xls and close this file, and then continue with the remaining code written in the macro.

    I cannot use onTime or sleep as I have no idea how much time will the user take to edit the file.

    Please help as I am stuck with this from past 2 days.

    Thanks for the help.

    Ankit
    Last edited by lifeankit; 05-01-2014 at 05:53 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Edit File Manually while Macro is running.

    You have to break your code into two separate routines.

    Open workbook and automatically run first code up to point where user intervention is required.
    Allow user to do things. When done they will need to start the second part of the code.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    11-29-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Edit File Manually while Macro is running.

    Thanks for the quick reply Andy.
    That would solve my purpose. However, if I want to do this without getting a button clicked, or any action from the user apart from closing of the excel....How can i do it?

    I was thinking to use BeforeClose function.Please advice.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Edit File Manually while Macro is running.

    You can make use of the before close event if the workbook is in a state to perform the second set of code.

    How do you know the user has completed requried editing and is not just closing the file?

  5. #5
    Registered User
    Join Date
    11-29-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Edit File Manually while Macro is running.

    I have a function that will check the changes made in the excel(as it is just a template).

    Thanks Andy. I will try using this method and will get back in case of any help required.

+ 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. Manually Unprotecting a pre-protected Macro Enabled file.
    By aaydee_15 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-17-2014, 02:36 PM
  2. [SOLVED] Advanced Filter Macro does not work, running manually works fine
    By jamiemc in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-09-2013, 07:22 PM
  3. Replies: 1
    Last Post: 07-15-2011, 01:24 AM
  4. [SOLVED] Running a macro to edit one line in existing VBA
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2006, 03:50 AM
  5. [SOLVED] Web query in macro doesn't work until you manually edit it
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-07-2005, 02:06 PM

Tags for this Thread

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