Using VB 6.0 and Office 2000 to create many large Excel workbooks and worksheets. When using "Range approach" to setting values/formating the WB/WS are created successuly, but cannot be opened w/o closing the VB application. When using a "Cells-Appraoch", it works OK but is VERY VERY slow; 25-40 minutes in the real application. Sample code below:
'.....you create application,wb,ws
with wb
with ws
'below will not release Excel, cannot open WB without_ closing VB application
.Range(Cells(1,1).Cells(20,14)).Value = "12345"
'---------------------------------------
'below will enable Excel opening w/o closing vb_ 'application
' for i = 1 to 20
' for j = 1 to 14
' .Cells(i,j).value = "12345"
' next j
' next i
'----------------------------------------
end with
end with
excelapp.quit
set ws = nothing
set wb=nothing
set excelapp=nothing
'.....you create application,wb,ws
with wb
with ws
'below will not release Excel, cannot open WB without_ closing VB application
.Range(Cells(1,1).Cells(20,14)).Value = "12345"
'---------------------------------------
'below will enable Excel opening w/o closing vb_ 'application
' for i = 1 to 20
' for j = 1 to 14
' .Cells(i,j).value = "12345"
' next j
' next i
'----------------------------------------
end with
end with
excelapp.quit
set ws = nothing
set wb=nothing
set excelapp=nothing