Home > Software engineering >  VB Exel Sort the second error 462
VB Exel Sort the second error 462

Time:10-15

Every time when I was running for the first time, the program run normally, but the second run to the sort of place, suggests that the remote server does not exist or cannot use; Hope you do me a favor, thank you so very, is part of the code below:

The Set xlApp=CreateObject (" Excel. Application ")
The Set xlBook=xlApp. Workbooks. Open (xlspath)
XlApp. Visible=True
The Set xlSheet=xlBook. Worksheets (1)

M=xlSheet Range (" D65536 "). The End (xlUp). Row
Code_col=4
Letter_count=0
Location="d: \ Split_Excel "
XlSheet. Range (" D2 "). Select
Selection. Sort Key1:=Range (D2), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
:=xlPinYin

CodePudding user response:

Have a say in the program after the add a END, but add the program out of the////on the END

CodePudding user response:

All use of global functions, prefix with your application, such as CentimetersToPoints (21), instead of wdApplication. CentimetersToPoints (21),
Reason, CentimetersToPoints function without a prefix, the default method using global, office of global object has a bug, however, no dynamically linked to the new app,
  •  Tags:  
  • VBA
  • Related