type mismatch error in vba excel -
i have code running individually(using f8 key) can output. whereas if run using f5 shows type mismatch error. how fix it. program reference:
sub getting_bom() sheets("data").range("a6:f1000").clearcontents 'launching web page set ie = createobject("internetexplorer.application") ie.visible = true url = "http://home.gsi.local/vbgsiweb/production/packinglist.aspx" ie.navigate2 url while ie.readystate <> 4 doevents loop while ie.busy = true doevents loop pnumber = sheets("data").range("b2").value sheets("data").select if pnumber <> "" while ie.busy = true doevents loop set search_box = ie.document.getelementbyid("txtitem") search_box.value = pnumber while ie.busy = true doevents loop if search_box nothing msgbox "connect gsi cisco first !!!", vbcritical, "gsi cisco problem" shell "c:\program files\cisco\cisco anyconnect secure mobility client\vpnui.exe", vbnormalfocus ie.quit sheets("data").select exit sub end if set table_val = ie.document.getelementbyid("lblpacklistdescription") while ie.busy = true doevents loop set search_button = ie.document.getelementbyid("btnsearch") search_button.click ' ie.visible = true application.wait (now + timevalue("0:00:04")) set table_header = ie.document.getelementbyid("lblpacklistdescription") if errno > 5 sheets("data").range("d6").value = "invalid item number" errno = 0 err.clear goto here end if if table_header.innertext = 0 err.clear goto here end if if err errno = errno + 1 err.clear goto there end if there: n = 5 = 6 300 **set table_val = ie.document.getelementbyid("dgpacklist")**(here shows error) availability = 0 nn = (i - 5) components = table_val.cells(nn * (11 + availavlity)).innertext if components = " " exit n = n + 1 range("b" & n).select sheets("data").range("a" & n).value = (i - 5) description_val = table_val.cells((nn * (11 + availability)) + 1).innertext qty_val = table_val.cells((nn * (11 + availability)) + 2).innertext sheets("data").range("b" & n).value = mid(components, 1, 500) sheets("data").range("c" & n).value = qty_val next end if call module1.part_long_description call module1.paste_description 'call module1.saveas_csv msgbox "task finished", vbinformation, "finished" here: ie.quit end sub
Comments
Post a Comment