Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tim Tim is offline
external usenet poster
 
Posts: 408
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic 2005 Express to make library for VBA (Excel) - How? MaxS Excel Programming 3 July 17th 06 10:18 AM
Creating xll files for excel 2003 with Visual C++ 2005 express JacksonRJones Excel Programming 0 March 15th 06 10:06 PM
I am using visual basic express edition 2005 Simon[_17_] Excel Programming 0 January 5th 06 09:51 AM
VB 2005 Express and VBA DLL´s [email protected] Excel Programming 3 November 10th 05 04:48 PM
working with excel from visual studio 2005 express bigdaddy3 Excel Programming 0 November 3rd 05 03:14 PM


All times are GMT +1. The time now is 02:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"