Automation Error: The Server threw an Exception

lucigen

New Member
Joined
Jun 9, 2011
Messages
15
Hey fellas, so the idea here is doing a sort of a giant set of data in a seperate workbook. Leading up to this point in the code we have xlSht defined as a sheet object, getXcoX is an integer. Last is a little routine to get the desired endpoint. I know for a fact that xlSht and getXcoX are valid since they are used earlier in the program.

Code:
xlSht.Activate
    xlSht.Columns("A:M").Select
 
    listMax = last(getXcoX, xlSht)
    'Sorting bit
    xlSht.Sort.SortFields.Clear
    xlSht.Sort.SortFields.Add Key:=Range(Cells(1, getXcoX).Address), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal

It errors out on the last line with the following message:

Runtime error '- 2147417851 (80010105):

Automation error
the server threw an exception

A google search didn't reveal any information about the runtime error with anything related to excel or within my comprehension. Anyone got a clue what that means? I would really like to avoid writing my own sorting algorithim

EDIT: Before anyone stsarts working on this, I think I am an idiot. The Range(Cells(1,getXcoX).address) thing isn't working properly. Don't think too hard on this guy
 
Last edited:

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
ok well stupidity aside, I still haven't figured this out yet. The root problem here is not that crazy error in the title, but Sorting in a different workbook, which I still can not figure out how to do.

Any/all help is appreciated greatly
 
Upvote 0
The idea is that it is the index of the key for the sort. So if XcoX was 2 then it would sort columns A:M by Column B
 
Upvote 0
What's the value of getXcoX when the code falls over?
 
Upvote 0
3 :(

I also tried replacing it with just "=Range("C1") to make sure it wasn't any kind of thing there, and it throws the same exception
 
Upvote 0
I have never seen VBA use that language.

What is your operating environment?
 
Upvote 0
Yea I have never seen it either, other changes resulted in a error 462 "the remote server machine does not exist or is unavailable" This is apparently encountered when trying to deal with a MSWord object (which isn't in my program at all) so I am modifying all the rest of my code to avoid this problem now instead of hitting my head against the wall.

Btw Office 2010 on 32bit Win 7

but yea, case closed, I'm dealing with it another way, thanks everyone for pondering the situation, I appreciate it even if no solution was found.
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,866
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top