Leester
Electrical
- Nov 7, 2008
- 1
Hi,
I'm writing in VB6. In my program, I create a workbook, add data to it, and format it. When all of that is done, I save the work book as some file name, and ATTEMPT to kill my Excel.application.
Here's the problem: I cannot fully open my newly created workbook if my program (the one that created it) is running. Excel starts up, and shows me the top menu bar, but doesn't 'fill-in' the rest of the screen. If I choose View|Full Screen, I can view my workbook!
DOES ANYONE KNOW WHAT I'M DOING WRONG? I assume I'm not completely killing off my Excel link to the workbook.
To see what I mean, you can
1. Open an new VB project (standard .exe)
2. Set a reference to 'Microsoft Excel 9.0 (or whatever) object Library'
3. Paste the following code into the Form_Load event:
'get a new excel app
Dim xlApp As New excel.Application
'open a workbook
xlApp.Workbooks.Add
'format a little
Range("A1:F1"
.Select
Selection.Interior.ColorIndex = 37
'save formatted worksheet
xlApp.ActiveWorkbook.SaveAs _
fileName:="C:\myWorkbook.xls", _
FileFormat:=xlWorkbookNormal
xlApp.Workbooks.Close
xlApp.Quit
4. Run the program and try to open the workbooke while the VB program is still running.
I REALLY appreciate any insight.
I'm writing in VB6. In my program, I create a workbook, add data to it, and format it. When all of that is done, I save the work book as some file name, and ATTEMPT to kill my Excel.application.
Here's the problem: I cannot fully open my newly created workbook if my program (the one that created it) is running. Excel starts up, and shows me the top menu bar, but doesn't 'fill-in' the rest of the screen. If I choose View|Full Screen, I can view my workbook!
DOES ANYONE KNOW WHAT I'M DOING WRONG? I assume I'm not completely killing off my Excel link to the workbook.
To see what I mean, you can
1. Open an new VB project (standard .exe)
2. Set a reference to 'Microsoft Excel 9.0 (or whatever) object Library'
3. Paste the following code into the Form_Load event:
'get a new excel app
Dim xlApp As New excel.Application
'open a workbook
xlApp.Workbooks.Add
'format a little
Range("A1:F1"
Selection.Interior.ColorIndex = 37
'save formatted worksheet
xlApp.ActiveWorkbook.SaveAs _
fileName:="C:\myWorkbook.xls", _
FileFormat:=xlWorkbookNormal
xlApp.Workbooks.Close
xlApp.Quit
4. Run the program and try to open the workbooke while the VB program is still running.
I REALLY appreciate any insight.