lgodfrey Posted October 6, 2004 Share Posted October 6, 2004 Hi Gurus!I have been running this script for weeks, and suddenly I am getting error message"Run Time Error '-2147417848 (80010108)'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 wendMS 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 Subuse insteadPublic 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 SubI found this info in this reference on MS Knowledge Base web site: MS KBA 319832At 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.Any suggestions?Best REgardsLarry I'm, Lovin' IT, X Link to comment Share on other sites More sharing options...
Matt @ MPCS Posted October 6, 2004 Share Posted October 6, 2004 Hi Gurus!I have been running this script for weeks, and suddenly I am getting error message"Run Time Error '-2147417848 (80010108)'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 wendMS 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 Subuse insteadPublic 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 SubI found this info in this reference on MS Knowledge Base web site: MS KBA 319832At 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.Any suggestions?Best REgardsLarry <{POST_SNAPBACK}>You shouldn't be using autoitx to do this anyway... look for the clipboard object in VB6. I believe what you are looking for is:Clipboard.GetDataThere are other methods to the clipboard object, I suggest getting to know these.*** Matt @ MPCS Link to comment Share on other sites More sharing options...
lgodfrey Posted October 6, 2004 Author Share Posted October 6, 2004 You shouldn't be using autoitx to do this anyway... <{POST_SNAPBACK}>Matt, I am not sure you have enough info to make this quick judgement. The clipboard contains a a copy of an entire web page. Excel thinks you want the HTML info, and tries to transfer it into the code. It is quirky in using it inside VBA, in my experience. The AutoITX3 GetClip statement strips out all the HTML junk and only transfers the ASCII into the VBA. This is what I want.In addition, this is a reported bug/problem that MS Office VBA has in dealing with objects outside the main application, and users of AutoITX3 should be aware/ hopefully know fixes. Last night, after I posted the start to this chain, another AutoITX3 call gave me the same error message, so it is not even necessarily symptomatic to clipboard alone! From what I've seen on my problem solving searches on the web, MS VBA is inherently quircky, and code can run for months and suddenly fail. I am in this situation now, although I do admit this code is a work in progress, and I may have added some code that makes this run time bug more porbable. It still works for hours and then fails suddenly.In addition, getclipboard.getdata is a pivot table operation, and I have no time to bother learning about pivot tables. My goal is to create a tool for me to use as quickly as possible, not learn parts of VBA I should not need to learn. This seperates me from programing professionals/IT specialists that need this type of thing "everday", ...I am a member of the user sub-group that wants AutiitX3/VBA as a quick means to an end, not a "life style". That being said, if I have to I will learn the additional parts of VBA that I need to eliminate the getclip call, but as I said earlier, I got the same error on another AutoITX3 call, so I do believe I really need to solve this problem so I can apply the solution to other AutoITX3 methods. (I do love those run on sentences don't I? )Anyone got any suggestions to solve the problem?Best REgardsLarry I'm, Lovin' IT, X Link to comment Share on other sites More sharing options...
lgodfrey Posted October 6, 2004 Author Share Posted October 6, 2004 What is it you are trying to do anyhow?<{POST_SNAPBACK}>I am using control send methods to refresh a website window, select all, copy to clipboard, and using clipget to transfer the text "as you see it" into VBA, without the HTML baggage. Work with the data while the web site is being reloaded with new live info, and repeat.If I just use paste to a cell inside Excel vba, it gives error messages (because of the baggage, I think), and if you try to use control send to paste the clipboard to a cell , it does not act like a typical cell past, but pops up a non-standard window to ask if you want to paste HTML, or two type of text choices.MS says this error can occour (intermitantly) with any external object unless you do the "binding" right but I have absolutely no idea what they are talking about.RegardsLarry I'm, Lovin' IT, X Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now