Using VBA and iMacros to take data from Excel Sheet to fill

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
jinhui
Posts: 9
Joined: Wed Oct 04, 2017 10:05 am

Using VBA and iMacros to take data from Excel Sheet to fill

Post by jinhui » Thu Oct 26, 2017 9:39 am

I have some error while running the VBA and the error code 429, ActiveX component can't create object, appears.

Code: Select all

Option Explicit

  
   Private Sub CommandButton2_Click()
   
   MsgBox "Reads data row from an Excel sheet and submit this information to a website."
   
   Dim imacro, iret, row, totalrows
   
   Set imacro = CreateObject("imacros")
   
   iret = imacro.iimInit
   'Firefox iret = test.iimInit ("-fx")
   iret = imacro.iimDisplay("Submitting Data from Excel")
   
   totalrows = ActiveSheet.UsedRange.Rows.Count
   For row = 2 To totalrows
      'Set the variables
      iret = imacro.iimSet("Short-Name*", Cells(row, 1).Value)
      iret = imacro.iimSet("Acct-Cntr-Type*", Cells(row, 2).Value)
      iret = imacro.iimSet("Base-Ccy*", Cells(row, 3).Value)
      'Set the display
      iret = imacro.iimDisplay("Row# " + CStr(row))
      'Run the macro
      iret = imacro.iimPlay("test.iim")
      If iret < 0 Then
         MsgBox imacro.iimGetLastError()
      End If
   Next row
   
   iret = imacro.iimDisplay("Submission complete")
   iret = imacro.iimExit

End Sub
The error occurs at test = CreateObject("test") stating that test=empty.

Is there any code I am missing out?

I am running on Firefox 47.0 and iMacro for Firefox 8.9.7. I am also running on Windows 7.
senor pengwin
Posts: 32
Joined: Thu Aug 17, 2017 10:33 pm

Re: Using VBA and iMacros to take data from Excel Sheet to f

Post by senor pengwin » Sat Jul 14, 2018 7:21 am

Code: Select all

iret = imacro.iimPlay("test.iim")
This line declares the name of your IMacro file, it appears as it if cannot find the saved IMacro file. Make sure you have an IMacro named "test.iim" in the default macro saves folder. If you have the file inside another folder inside the default path you will need to include that as well.

Code: Select all

iret = imacro.iimPlay("Foldername\test.iim")
aegorhum
Posts: 7
Joined: Mon Jul 09, 2018 8:31 pm

Re: Using VBA and iMacros to take data from Excel Sheet to f

Post by aegorhum » Tue Jul 17, 2018 6:14 pm

Why are you commenting out the second line here? Also, why do you have firefox in front of it?

Code: Select all

   iret = imacro.iimInit
   'Firefox iret = test.iimInit ("-fx")
   iret = imacro.iimDisplay("Submitting Data from Excel")
Try this?

Code: Select all

   iret = imacro.iimInit
   iret = test.iimInit ("-fx")
   iret = imacro.iimDisplay("Submitting Data from Excel")
Or this?

Code: Select all

Dim iim1, iret
set iim1 = CreateObject ("imacros")
iret = iim1.iimOpen("-fx")
Post Reply