VBA Error "Object Required" in Excel

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.

Moderator: iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

VBA Error "Object Required" in Excel

by darrington on Thu Mar 06, 2008 3:34 pm

I am working on a project to get some gas prices from a website - the Macro runs fine standalone but I tried to embed it in Excel and wrote the following code by uising the example of the stock prices in the tutorial.

I try to run the code in Excel and I get an error "Object Required" and the line: "iret = iim.iimPlay("Gas1")" is highlighted. My macro is called Gas1 in iMacros.

Can anyone help? I'm using the trial version at the moment if that matters...

Thanks!



Private Sub CommandButton1_Click()

Dim iim1, iret, row, totalrows

Set iim1 = CreateObject("imacros")
iret = iim1.iimInit
iret = iim1.iimDisplay("Submitting Data From Excel")

'Navigate to site and extract first price
row = 6
'Set the Variable
iret = iim1.iimSet("-var_ZipCode", Cells(row, 1).Value)
'Set the Display
iret = iim1.iimDisplay("Row# " + CStr(row))
'Run the Macro
iret = iim.iimPlay("Gas1")
If iret < 0 Then
MsgBox iim.iimGetastError()
End If
Cells(row, 3).Value = iim.iimGetLastExtract(0)

'Loop through Zip List and extract remaining prices
totalrows = ActiveSheet.UsedRange.Rows.Count
For row = 7 To totalrows
'Set the Variable
iret = iim1.iimSet("-var_ZipCode", Cells(row, 1).Value)
'Set the Display
iret = iim1.iimDisplay("Row# " + CStr(row))
'Run the Macro
iret = iim.iimPlay("Gas2")
If iret < 0 Then
MsgBox iim.iimGetastError()
End If
Cells(row, 3).Value = iim.iimGetLastExtract(0)
Next row


End Sub
darrington
 
Posts: 1
Joined: Thu Mar 06, 2008 3:29 pm

by Tech Support on Fri Mar 07, 2008 6:08 pm

This is just a typo ;)

You wrote

iret = iim.iimPlay("Gas1")

but it should be

iret = iim1.iimPlay("Gas1")
User avatar
Tech Support
 
Posts: 4988
Joined: Tue Sep 20, 2005 12:25 pm

Re: VBA Error "Object Required" in Excel

by zmx on Wed May 07, 2008 7:34 am

i wrote the almost the sme macro but i get a activex problem :

activex component cannot create object
(run time error 429 )


Sub ac()

Dim iim1, iret, row, totalrows

Set iim1 = CreateObject("imacros")
iret = iim1.Init
iret = iim1.iimdisplay("submitting data from excel")

row = 1
iret = iim1.iimSet("-var_companyname", Cells(row, 1).Value)
iret = iim1.iimdisplay("row#" + CStr(row))
iret = iim1.iimPlay("macr1")
If iret < 0 Then
MsgBox iim1.iimgetlasterror()
End If

Cells(row, 2).Value = iim1.iimgetlastextract(0)

totalrows = ActiveSheet.UsedRange.Rows.Count
For row = 2 To totalrows
iret = iim1.iimSet("-var_companyname", Cells(row, 1).Value)
iret = iim1.iimdisplay("row#" + CStr(row))
iret = iim1.iimPlay("macr1")
If iret < 0 Then
MsgBox iim.iimgetlasterror()
End If
Cells(row, 2).Value = iim1.iimgetlastextract(0)
Next row

iret = iim1.iimdisplay("bakma tamamlandı")
iret = iim1.iimexit


End Sub
zmx
 
Posts: 5
Joined: Wed May 07, 2008 7:00 am

Re: VBA Error "Object Required" in Excel

by Tech Support on Fri May 09, 2008 3:21 pm

At what line do you get this error? Does it come from imacros.exe?
User avatar
Tech Support
 
Posts: 4988
Joined: Tue Sep 20, 2005 12:25 pm

Re: VBA Error "Object Required" in Excel

by zmx on Sun May 11, 2008 1:48 am

Set iim1 = CreateObject("imacros")

@3rd line

it comes from excel macro
zmx
 
Posts: 5
Joined: Wed May 07, 2008 7:00 am

Re: VBA Error "Object Required" in Excel

by zmx on Thu May 15, 2008 11:49 am

topic update
zmx
 
Posts: 5
Joined: Wed May 07, 2008 7:00 am


Return to General Support & Discussions

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Website Monitoring