Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error Automating Excel from Access (Office 2000 Sr1a)

    I have written code in Access to create a new instance of the Excel application object and then a new workbook using the "Add" method. This workbook is then populated with data from Access tables and queries to produce a wall chart (Outlook just couldn't do the job I wanted) showing a bookings calendar.
    It all works fine and Access closes and saves the workbook and Excel, seemingly correctly. Variables are set to 'Nothing" at the end too.
    But if I use the Function routine again, without closing and re-opening Access first, I get an error part way into the routine saying;
    " Method 'Range' of object '_Global' failed"
    What on earth does this mean?
    Of course the HTML help button just produces a big blank window which just sits there, no matter how many coffees I consume waiting for the magic answer.
    It would seem that some reference is lost or still in memory blocking the routine from running a second time in the same session of Access.
    Any ideas how to fix this?

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error Automating Excel from Access (Office 2000 Sr1a)

    I found out the rather subtle answer at Microsoft's Knowledge base (it seems to be getting more user friendly these days)
    Since this may baffle someone else (most likely I would say) then I post here the link to the appropriate document that explains all...
    http://support.microsoft.com/default.aspx?...b;en-us;Q178510
    But basically I called the Range property without preceding it with an object variable standing for a worksheet or another range object. You can only do this apparently if you are referring to the Application object.

Posting Permissions

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