Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Excel Macro failing to run from Access call... (97 SR-2)

    Hello All...

    At the office, I'm running Access 97 and Excel (and the rest of Office) 2000... I was just wondering whether anyone has had, or heard of, a problem running Excel macros from within Access... I had added the code to a procedure in Access to open a workbook and run a macro... For some reason it seems to fail whenever it feels like it... No errors... No warnings... No patterns that I've noticed... Just doesn't work sometimes... If I step through the code it works fine... Every time... ???... Strange but true... <img src=/S/hmmn.gif border=0 alt=hmmn width=15 height=15>

    I've already worked it out... Got rid of the Excel macro and have all the code to manipulate the workbooks running from inside Access now... I'm simply curious as to whether this is a known issue, or if someone has a clue why it would happen... It would save me time for next time...

    Thanks in advance... <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Excel Macro failing to run from Access call... (97 SR-2)

    If it works when you step through the code, but not always when you run it, there might be some kind of timing problem. Without seeing the code, it's hard to say, but I guess it's not that important any more.

  3. #3
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Excel Macro failing to run from Access call... (97 SR-2)

    That's what I thought too Hans...

    In my Access procedure I had two lines pertaining to this macro... (xlApp has been declared and set already)

    xlApp.Workbooks.Open Filename:= gstrFileLocation & "fxrates_import.xls"
    xlApp.Application.Run "fxrates_import!fmt_rates"

    The "fmt_rates" macro did some manipulation to make the data ready to import into Access...
    Does Application.Run not entirely complete before the next line of code in Access runs?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Excel Macro failing to run from Access call... (97 SR-2)

    It might well be that Access just passes the Run instruction to Excel, then goes on to the next instruction. But I am not sure.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •