How to create a New Excel File using VBScript? What am I doing wrong?
Please see the below code. It writes into new excel file but I do not know how to save it. If you have another solution to create a NEW Excel File, please let me know.
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">' Launch Excel
set app = createobject("Excel.Application"
' Make it visible
app.Visible = true
' Add a new workbook
set wb = app.workbooks.add
' Fill array of values first...
dim arr(19,9) ' Note: VBScript is zero-based
for i = 1 to 20
for j = 1 to 10
arr(i-1,j-1) = i*j
' Declare a range object to hold our data
set rng = wb.Activesheet.Range("A1".Resize(20,10)
' Now assign them all in one shot...
rng.value = arr
' Give the user control of Excel
app.UserControl = true</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">Thanks,
Re: How to create a New Excel File using VBScript? What am I doing wrong?
use "wb.save <filename>" to save the workbook