Click to See Complete Forum and Search --> : Excel VBA


February 21st, 2000, 12:00 PM
I am calling Excel(2000/97)objects in my VB application. After importing data into my workbook, saving it under a new file name and quiting Excel, I would get only the frames of an Excel application without Excel contents in the client area if I attempt to display another Excel file in my application. If I exit my VB application, then I can display the Excel window properly. I tried refreshing the window without success. I tried to close all of my workbooks by using:
Workbooks.Close

It did not work either.

I used the codes like the following to define my workbook:
Dim Wkb As Workbook
Set Wkb = Workbooks.Add

What did I do wrong?

Thanks in advance.

Serge_D
February 21st, 2000, 12:39 PM
You have to close the Workbook before you can access it:


Dim Wkb as Workbook
set Wkb = Workbooks.Add

'Do your stuff here

'Close Workbook with saving it
Wkb.Close true





Serge
Software Developer
Serge_Dymkov@vertexinc.com

February 21st, 2000, 03:24 PM
Thanks for your suggestion to my question. I tried your suggestion but it did not work for me. What I need to do is this:

1.Import an ASCII text file (ASCII.txt) into an Excel file using Workbooks.Add.
2.Save the produced Excel file as RESULT.xls.
This accomplish one operation.
3.Open RESULT.xls with Excel window minimized and add more worksheets to RESULT.xls.
4.Once step 3 is completed, Excel display window is maxmimized. This is where only the Excel frame is displayed.

Any more suggestions?

Thanks again.