I have a Windows form application that creates
a report and display data in Excel. When I open the
Excel file with Explore I can only see the Excel Menu
without the workbook. If I click on the View menu and
Full Screen item menu, then the workbook is displayed.

Why is this?

The following example code is below from MSDN.
Thanks

Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object

'Start a new workbook in Excel.
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add

'Add data to cells of the first worksheet in the
new workbook.
oSheet = oBook.Worksheets(1)
oSheet.Range("A1").Value = "Last Name"
oSheet.Range("B1").Value = "First Name"
oSheet.Range("A1:B1").Font.Bold = True
oSheet.Range("A2").Value = "Doe"
oSheet.Range("B2").Value = "John"

'Save the Workbook and quit Excel.
oBook.SaveAs(sSampleFolder & "Book1.xls")
oSheet = Nothing
oBook = Nothing
oExcel.Quit()
oExcel = Nothing

Re: Object Excel and explore Issue by Sijin

Sijin
Fri Sep 03 02:12:08 CDT 2004

You can try activating the workbook

oBook.Activate()

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph



Nancy. wrote:
> I have a Windows form application that creates
> a report and display data in Excel. When I open the
> Excel file with Explore I can only see the Excel Menu
> without the workbook. If I click on the View menu and
> Full Screen item menu, then the workbook is displayed.
>
> Why is this?
>
> The following example code is below from MSDN.
> Thanks
>
> Dim oExcel As Object
> Dim oBook As Object
> Dim oSheet As Object
>
> 'Start a new workbook in Excel.
> oExcel = CreateObject("Excel.Application")
> oBook = oExcel.Workbooks.Add
>
> 'Add data to cells of the first worksheet in the
> new workbook.
> oSheet = oBook.Worksheets(1)
> oSheet.Range("A1").Value = "Last Name"
> oSheet.Range("B1").Value = "First Name"
> oSheet.Range("A1:B1").Font.Bold = True
> oSheet.Range("A2").Value = "Doe"
> oSheet.Range("B2").Value = "John"
>
> 'Save the Workbook and quit Excel.
> oBook.SaveAs(sSampleFolder & "Book1.xls")
> oSheet = Nothing
> oBook = Nothing
> oExcel.Quit()
> oExcel = Nothing
>

Re: Object Excel and explore Issue by Nancy

Nancy
Tue Sep 07 08:08:02 CDT 2004

Thanks it works! It was so simple.
>-----Original Message-----
>You can try activating the workbook
>
>oBook.Activate()
>
>Sijin Joseph
>http://www.indiangeek.net
>http://weblogs.asp.net/sjoseph
>
>
>
>Nancy. wrote:
>> I have a Windows form application that creates
>> a report and display data in Excel. When I open the
>> Excel file with Explore I can only see the Excel Menu
>> without the workbook. If I click on the View menu and
>> Full Screen item menu, then the workbook is displayed.
>>
>> Why is this?
>>
>> The following example code is below from MSDN.
>> Thanks
>>
>> Dim oExcel As Object
>> Dim oBook As Object
>> Dim oSheet As Object
>>
>> 'Start a new workbook in Excel.
>> oExcel = CreateObject("Excel.Application")
>> oBook = oExcel.Workbooks.Add
>>
>> 'Add data to cells of the first worksheet in
the
>> new workbook.
>> oSheet = oBook.Worksheets(1)
>> oSheet.Range("A1").Value = "Last Name"
>> oSheet.Range("B1").Value = "First Name"
>> oSheet.Range("A1:B1").Font.Bold = True
>> oSheet.Range("A2").Value = "Doe"
>> oSheet.Range("B2").Value = "John"
>>
>> 'Save the Workbook and quit Excel.
>> oBook.SaveAs(sSampleFolder & "Book1.xls")
>> oSheet = Nothing
>> oBook = Nothing
>> oExcel.Quit()
>> oExcel = Nothing
>>
>.
>