Results 1 to 6 of 6

Thread: Execution of a Macro in Access to import Excel

  1. #1
    Join Date
    May 2008
    Posts
    222

    Execution of a Macro in Access to import Excel

    Hello
    I'm having a problem when importing into Excel results of an Access query, here is my explanation.
    1. I have an Access table that updates itself automatically to the opening of the base thanks to an AutoExec macro.
    2. The goal is to import the data in an Access query to an Excel spreadsheet.
    3. The whole system of import external data in Excel is set up, my data are extracted and imported into the leaf.
    4. The worry is that the updated data in Excel does not run the Access macro AutoExec.
    Is there a solution to solve this problem? Thanks in advance.
    Last edited by Brunoz; 24-12-2009 at 11:25 AM.

  2. #2
    Join Date
    May 2008
    Posts
    4,570

    Re: Execution of a Macro in Access to import Excel

    Hello
    In the first 3 points you make a shipment from Access to Excel, no worries. I do not see how you can place the third step, since you only work one way out. If you put updated Excel from Access, why do you make entries in Excel. I have a little trouble understanding what you want done. More explanation will be highly appreciated.

  3. #3
    Join Date
    May 2008
    Posts
    222

    Re: Execution of a Macro in Access to import Excel

    Hello
    Thank you for your interest, I'll try to be as clear as possible despite my lack of knowledge in this field.

    - I am making a track purchase requests for subcontracting in 4 Excel files (one per sub-contractors).

    - My Access database is fed from the 4 Excel files and aggregates data in a single table using several queries deletion / addition. The table in question is recreated every time you open the Access database with a macro AutoExec.

    - A select query sorts of information to present a synthesis of sub-contractors working on site.

    - To simplify the reading of this information to others, I created a new Excel file which is updated by fetching the result of my Access application automatically (I have used for this function Data> External Data> Create a request ).

    - My problem is that the updated Access database by the AutoExec macro does not occur during the update of Excel, then suddenly I'm forced to open Access before opening Excel that my data is correctly updated.

    I hope I have been more explicit, does not hesitate to tell me if this is not the case.

  4. #4
    Join Date
    May 2008
    Posts
    4,570

    Re: Execution of a Macro in Access to import Excel

    Hi
    I begin to understand at this time you should close the Excel file, initiate a routine (A Shell or ShellExecute API) that launches your Access database that it will launch your macro AutoExec. Hope this will help you.
    I hope I have been more explicit, does not hesitate to tell me if this is not the case.
    This time you are more clearer and I have under the exact problem.

  5. #5
    Join Date
    May 2008
    Posts
    222

    Re: Execution of a Macro in Access to import Excel

    Hi
    I agree to you, but how do I do that? Another person gave me the VBA code, that says:
    ExAccess.OpenCurrentDatabase "c: \ Ex.mdb" 'open your database from Excel
    'ExAccess.DoCmd.RunMacro "AutoExec"' executes your macro
    ExAccess.Quit acQuitSaveNone 'Closes Access
    Set ExAccess = Nothing
    Maybe I could "go" somewhere in Excel to run when it opened before the automatic update of my cells? I appreciate you help.

  6. #6
    Join Date
    May 2008
    Posts
    4,570

    Re: Execution of a Macro in Access to import Excel

    Hello
    I would say the "Workbook_BeforeCloseJust" before closing to Launch Access, by this time the seizures will be updated. I think for more information you should view some of the official excel forums from microsoft. I think it can help you and even post your query there.

Similar Threads

  1. Excel 2003 Macro doesn't work in Excel 2007
    By jjaw in forum Windows Software
    Replies: 3
    Last Post: 03-01-2014, 03:28 PM
  2. How to Import CSV files using Macro in Excel
    By Kungfu Pandey in forum Microsoft Project
    Replies: 2
    Last Post: 08-01-2012, 06:37 PM
  3. How to use Excel Macro
    By aSITA in forum Windows Software
    Replies: 5
    Last Post: 12-02-2011, 10:34 PM
  4. Code execution has been interrupted in Excel
    By Vineeta in forum Windows Software
    Replies: 3
    Last Post: 04-11-2009, 12:31 PM
  5. Excel 2007: Need Macro at quick access toolbar
    By Deep123 in forum Windows Software
    Replies: 2
    Last Post: 05-05-2009, 08:09 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
  •  
Page generated in 1,714,143,405.51222 seconds with 17 queries