Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem trying to use Excel objects in VS 2005 Express - Worksheet
In the following routine, the ws (Excel.Worksheet object) get set to
a System.__ComObject with 'Children could not be evaluated What is wrong? Sub Test() Dim xlApp As New Excel.Application xlApp.Visible = True Dim wb As Excel.Workbook = xlApp.Workbooks.Add Dim ws As Excel.Worksheet = _ DirectCast(wb.ActiveSheet, Excel.Worksheet) ' ws get set to a System.___ComObject and 'Children could not be evaluated ' Dim ws As Excel.Worksheet = DirectCast(wb.Worksheets(1), Excel.Worksheet) ' Dim ws As Microsoft.Office.Interop.Excel.Worksheet For Each ws In wb.Sheets Debug.Print(ws.Name) If ws.Name = "Sheet1" Then ws.Range(ws.Cells(1, 1)).Formula = "XXX" End If Next wb.Close() : xlApp.Quit() ws = Nothing : wb = Nothing : xlApp = Nothing End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Visual Basic 2005 Express to make library for VBA (Excel) - How? | Excel Programming | |||
Creating xll files for excel 2003 with Visual C++ 2005 express | Excel Programming | |||
I am using visual basic express edition 2005 | Excel Programming | |||
VB 2005 Express and VBA DLL´s | Excel Programming | |||
working with excel from visual studio 2005 express | Excel Programming |