vbscript - Reading and writing with Excel (very very strange) -
i have application supposed take inputted url , file name (aswell value due there being multiple documents save) , write values excel document. example
| facebook.com | facebook | 3 | youtube.com | youtube | | google.com | google |
the first url, second file name, , third number of documents (basically).
at moment happens first 2 cells contain continuosly updating numbers , third contains "[object]"
first hta vbs
sub export dim url_1 ' url being saved excel dim filename_1 ' name file being saved dim fullpath ' path of file dim oexcel ' excel dim obook ' workbooks dim osheet ' worksheets dim iv ' interval value dim ic ' interval cap dim target ' target filepath 'sets interval cap ic = ic_ ' declares fso set fso = createobject("scripting.filesystemobject") ' declares full file path fullpath = fso.getabsolutepathname(foldername) 'sets target target = fullpath & "\list.xls" ' launch excel set oexcel = createobject("excel.application") ' toggles visibility oexcel.application.visible = true ' open workbook set obook = oexcel.workbooks.open(cstr(target)) iv = 0 ic = ic_ while iv <= ic url =cstr (url_1 & iv) filename = cstr(filename_1 & iv) 'writes values excel oexcel.cells(1,3).value=ic_ oexcel.cells(1,1).value=url oexcel.cells(1,2).value=filename iv = iv + 1 wend ' save workbook, obook.save ' quit excel oexcel.quit end sub </script> <body> <input type="button" value="add que" name="export_run" onclick="export"> <input type="button" value="extract" name="extractor_run" onclick="extract"> url <input type="text" value="" name=url_1> <br> file name <input type="text" value="" name=filename_1> <br> no. pages <input type="text" value="" name=ic_> <br> </body>
thanks in advanced willing me fix mess. work have far has been taking existing code , rearanging things. has been long time since used vb , never kind of task.
ic_
htmlinputelement
object. text input field should use ic_.value
, , need convert integer if want compare integer. also, should assign value once, , work converted value throughout rest of script.
... 'sets interval cap ic = clng(ic_.value) set fso = createobject("scripting.filesystemobject") fullpath = fso.getabsolutepathname(foldername) target = fullpath & "\list.xls" set oexcel = createobject("excel.application") oexcel.application.visible = true set obook = oexcel.workbooks.open(cstr(target)) iv = 0 ic = ic_ while iv <= ic url = cstr (url_1 & iv) filename = cstr(filename_1 & iv) oexcel.cells(1,3).value = ic oexcel.cells(1,1).value = url oexcel.cells(1,2).value = filename iv = iv + 1 wend ...
Comments
Post a Comment