+ Reply to Thread
Results 1 to 5 of 5

Run Macro in Excel from Autocad

  1. #1
    Registered User
    Join Date
    03-11-2010
    Location
    SINGAPORE
    MS-Off Ver
    Excel 2007
    Posts
    12

    Unhappy Run Macro in Excel from Autocad

    Hi all,
    i have almost completed my project, but i am facing a problem.
    I have a VBA program ( in ACAD), that opens a workbook and retrieve the data to generate drawings , based on excel cells values; this works perfectly.
    Now , i want my ACAD program to load this same WB in excel, then execute a macro (based in the excel WB), then when complete continue to run the program in ACAD.
    Before the first Excel macro is executed, it needs to get a value from ACAD user form input box, then use it for its macro ( Excel).
    So my the question is in the title : how i can run the macro in excel from ACAD ?
    i cannot figure out the code associated to this. Hope it is clear.
    This is the code i try to run the macro:
    it opens the excel sheet, but then excel freeze as soon as it passes the line "run..."
    Please Login or Register  to view this content.

    Thanks for your help.
    Last edited by Breizh29; 03-29-2010 at 08:24 AM.

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Run Macro in Excel from Autocad

    Hi Breizh29

    You have enclosed your code in Quote Tags not Code tags, if you correct this then I will have a look, your code appears to be cut short.

    I wrote the Excel/AutoCad macro

    Cheers
    Alistair

  3. #3
    Registered User
    Join Date
    03-11-2010
    Location
    SINGAPORE
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Run Macro in Excel from Autocad

    Thanks Alistair,
    yes this is a part of your code.
    As i have many code lines below i did not want to overload the page.
    I tried this afternoon in running the macro direct from Excel, it works without problem.
    Then when i execute from ACAD with the code above, it seems to launch it on excel, but then Excel freeze.
    I think the macro in ACAD runs the macro from excel from the first WS ( where it shoudl be run), but then try to access "Sheet1" in the same time, where the data ( result of the macro) resides.
    I may have to enter a code that waits for the end of the macro, before it can continue its code in ACAD ?
    Thanks for your help.

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Run Macro in Excel from Autocad

    Hi Breizh

    Thanks for changing your post.

    It doesn't show the whole Sub. Does it show all your changes?

    It would be better with a sample file showing me what "Schedule4Trays.xlsm!ODCheck" does, I can guess by the sheetname, but guessing is never a good thing. Are the tray sizes in the same workbook?

    Then I can set it up to try the whole exercise.

    Is that possible?

    I'm a bit rusty with AutoCAD Vba so it might take a few days to get you a result, unless , of course, someone else has a go.

    Cheers
    Alistair

  5. #5
    Registered User
    Join Date
    03-11-2010
    Location
    SINGAPORE
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Run Macro in Excel from Autocad

    Hi,
    here below the main part of code , which will be maybe more helpful to locate where is the problem .
    I did copy only the first half part.
    The macro i want to execute : ODCheck, has to be run with the " SEA_DRAGON_CABLE_SCH" WS activated.
    Then it extracts some data to copy them in Sheet1!.
    ACAD then uses these data from Sheet1! to generate its drawing.
    Hope its more clear.

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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