I have been running this script for weeks, and suddenly I am getting error message
"Run Time Error
Method 'ClipGet' of object 'IControl' failed.
here is enough of the script to understand the situation (I think)
(I am using AutoITX3 inside Excel VBA, the sClipBoard statement gets executed many times, but the dimensioning and SET statements only once.)
Dim oAIX As Object 'Set up access to AutoITX3 Set oAIX = CreateObject("AutoItX3.Control") Dim sClipBoard As String While 1 sClipBoard = CStr(oAIX.ClipGet) '<-this is where fatal error now occuring. ...bunch of code to analyse what was brought in from the clipboard ...exit if proper conditions are met wend
MS web site talks about "early binding" and "late binding", and I think it says that repeated references to the object can create multiple occurances, confusing VBA. You can get unstable results, working sometimes, not others. Late binding stops this, and then gives examples where essentially the object has more modifiers to help VBA recognize it better. EG instead of refering to a MSWord object from within Excel as
Sub AddSomeText() Activedocument.Paragraphs(3).Range.Select Selection.Collapse wdCollapseEnd Selection.TypeText "Some new text." End Sub
Public oGlobalWordApp As Word.Application Sub AddSomeText() If oGlobalWordApp Is Nothing Then ' Sets variable to the running instance of the Word ' Global object (which is nearly the same as Word.Application)... Set oGlobalWordApp = Word.Global End If oGlobalWordApp.Activedocument.Paragraphs(3).Range.Select oGlobalWordApp.Selection.Collapse wdCollapseEnd oGlobalWordApp.Selection.TypeText "Some new text." End Sub
I found this info in this reference on MS Knowledge Base web site: MS KBA 319832
At this point I am in over my head. I do not see how I apply their example to this simple code. I do not understanding binding to know if there is a fix.