{"id":10379,"date":"2021-12-05T11:52:41","date_gmt":"2021-12-05T11:52:41","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=10379"},"modified":"2021-12-05T11:53:02","modified_gmt":"2021-12-05T11:53:02","slug":"solved-how-to-fix-run-time-error-424-in-vb-script","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/how-to-fix-run-time-error-424-in-vb-script\/30443.html","title":{"rendered":"Solved How To Fix &#8216;Run Time Error 424&#8217; In Vb Script"},"content":{"rendered":"<p>im not a familiar with programming basics.<\/p>\n<p>im getting &#8216;Run time error 424 &#8216; object required, when executing the script provided in #5<\/p>\n<p>im using the script as macro in Excel, any idea what im doing wrong?<\/p>\n<p>Sub XMLFind()<br \/>\n&#8216;==== begin vbscript &#8220;xmlfind&#8221;<br \/>\nIf wscript.arguments.Count &lt; 1 Then<br \/>\nwscript.echo &#8220;Usage: XMLFIND C:\\Users\\vik\\Documents\\XMLTest\\CD_catalog.xml targetstring&#8221;<br \/>\nwscript.Quit<br \/>\nEnd If<br \/>\ntarg = wscript.arguments(1)<br \/>\nSet fso = CreateObject(&#8220;scripting.filesystemobject&#8221;)<br \/>\nSet test = fso.opentextfile(wscript.arguments(0), 1)<br \/>\nZ = test.readall<br \/>\n&#8216;remove lcase() from foll line to observe case in search<br \/>\npoint1 = InStr(LCase(Z), LCase(targ))<br \/>\nIf point1 = 0 Then<br \/>\nwscript.echo &#8220;NOT FOUND: string: &#8221; &amp; targ<br \/>\nwscript.Quit<br \/>\nEnd If<br \/>\npoint1 = point1 + Len(targ)<br \/>\nfound = LTrim(Mid(Z, point1))<br \/>\nquote = Left(found, 1)<br \/>\nfound = Mid(found, 2)<br \/>\npoint2 = InStr(found, quote)<br \/>\nIf point2 &gt; 0 Then<br \/>\nfound = Left(found, point2 &#8211; 1)<br \/>\nEnd If<br \/>\nwscript.echo Chr(34) &amp; found &amp; Chr(34)<br \/>\n&#8216;===== end vbscript<br \/>\nEnd Sub<\/p>\n<p>Script obtained from below link:<br \/>\n<a href=\"https:\/\/web.archive.org\/web\/20161230155849\/https:\/\/computing.net\/answers\/programming\/batch-file-to-read-some-data-from-xml\/28549.html\" target=\"_blank\" rel=\"noopener\">https:\/\/computing.net\/answers\/pr&#8230;<\/a><\/p>\n<p>End result:<br \/>\nwhat i&#8217;m trying to do is to create macro or batch to extract a field name &amp; its value from a xml file.<\/p>\n<p>The XML file im using is contain 4 or 5 level nodes.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p align=\"right\"><span style=\"font-size: xx-small;\"><i>message edited by vennpura<\/i><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":19},"question-category":[55],"question_tags":[],"class_list":["post-10379","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/10379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=10379"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=10379"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=10379"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=10379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}