+ Reply to Thread
Results 1 to 3 of 3

VBA Method 'Range' of object '_Global' failed error

  1. #1
    Registered User
    Join Date
    03-05-2009
    Location
    Vail, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    83

    Post VBA Method 'Range' of object '_Global' failed error

    VBA Method 'Range' of object '_Global' failed error
    ObjXL is a variable in MS Access code.
    There are two dozen working Access functions that use Excel VBA to create custom reports.
    This error appeared when this code was added to a working function.
    It appears to have worked once (when the workstation was rebooted) and then failes at line 1280 after that.
    Update: sure enough, it works one time with the debugger halted on 1300 and then a step through
    The second time -it failes at 1300
    Please Login or Register  to view this content.
    Last edited by RxMiller; 08-30-2011 at 11:07 AM. Reason: validated it works once, then fails thereafter

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: VBA Method 'Range' of object '_Global' failed error

    You need to qualify the range object with its worksheet/workbook parentage.

  3. #3
    Registered User
    Join Date
    03-05-2009
    Location
    Vail, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    83

    Re: VBA Method 'Range' of object '_Global' failed error

    1300 .ActiveWorkbook.Worksheets("T_84 Report").Sort.SortFields.Add Key:=ObjXL.Range( _
    "A6:A3338"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    (and three other Range objects in the code above)
    You are so correct!
    I just figured it out, tested it and came back to update this post. Thanks so much!

+ 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