[英]Why does my code throw an error “ActiveX component can't create object”
Sub imacros()
Dim iim1, iret
Set iim1 = CreateObject("imacros")
iret = iim1.iimInit("", True)
Dim macro
macro = "CODE:"
macro = macro + "'Uses a Windows script to submit several datasets to a website, e. g. for filling an online database" + vbNewLine
macro = macro + "' Specify input file (if !COL variables are used, IIM automatically assume a CSV format of the input file" + vbNewLine
macro = macro + "'CSV = Comma Separated Values in each line of the filE" + vbNewLine
macro = macro + "TAB T=1" + vbNewLine
macro = macro + "SET !DATASOURCE C:\Users\Desktop\test\test.csv" + vbNewLine
macro = macro + "'Start at line 2 to skip the header in the file" + vbNewLine
macro = macro + "'Increase the current position in the file with each loop " + vbNewLine
macro = macro + "' Fill web form " + vbNewLine
macro = macro + "TAB T=1" + vbNewLine
macro = macro + "TAB CLOSEALLOTHERS" + vbNewLine
macro = macro + "SET !PLAYBACKDELAY 0.2" + vbNewLine
macro = macro + "URL GOTO=secured URL here" + vbNewLine
macro = macro + "TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:name CONTENT={{!COL1}}" + vbNewLine
macro = macro + "TAG POS=1 TYPE=INPUT:SUBMIT ATTR=TYPE:submit" + vbNewLine
macro = macro + "TAG POS=1 TYPE=TABLE ATTR=CLASS:standardTable EXTRACT=TXT" + vbNewLine
macro = macro + "SAVEAS TYPE=EXTRACT FOLDER=""C:\Users\Desktop\test"" FILE=""test_image.csv""" + vbNewLine
macro = macro + "" + vbNewLine
iret = iim1.immPlay(macro)
End Sub
Above is the code that im using. 上面是即时通讯使用的代码。 Could someone please let me know if there is something wrong with that and the reason for error?
有人可以让我知道这是否有问题以及错误的原因吗? * Converted the code from imacros using iMacros Scripting Code Creator to VBS string
*使用iMacros脚本代码创建器将代码从imacros转换为VBS字符串
This line might have wrong quotation marks: 该行可能带有错误的引号:
macro = macro + "URL GOTO="secured URL here" + vbNewLine
You can see it here, as the next line is marked as a string: 您可以在这里看到它,因为下一行被标记为字符串:
macro = macro + "URL GOTO="secured URL here" + vbNewLine
macro = macro + "TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:name CONTENT={{!COL1}}" + vbNewLine
Remove the quotation mark after the equal sign and try again. 删除等号后的引号,然后重试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.