Tag Archives: The macro

VBA 400 error

Failure phenomenon: VBA small program, after running macro, sometimes can proceed smoothly, sometimes on the “wind”, 400 errors

Solution: There are a lot of things that could cause 400 errors, but my solution is strange, just activate the worksheet of the action. This object is probably caused by the use of thisWorkBook… This problem can be fixed by using thisWorkbook.sheets (“Sheet1”).activate.

Such as
Set objData = New DataObject
sHTML = Range(“E” & (I)). The Value
sHTML = Replace (sHTML, “& lt; br />” PutInClipboard
ActiveSheet.Paste Destination:=Range(“E” & (i))

As long as to
Set objData = New DataObject
SHTML = Range (” E “& amp; (I)). The Value
sHTML = Replace (sHTML, “& lt; br />” . PutInClipboard
thisworkbook.sheets (“Sheet1”).Activate
activesheet.paste Destination:=Range(“E” & (i))
I’m going to report 400 errors