[RESOLVED] Office Automation.. where is intellisense hiding?
howzit guys.. :wave:
the following sub creates an Excel object, manipulates it,
then saves it to disc.
VB Code:
Private Sub Expo(ByVal t As String, ByVal name As String)
Dim tmp As String
tmp = "c:\Done Reports\" & Date.Today.ToString("MMM,dd") & "\" & Me.Name.ToString
If Directory.Exists(tmp) = False Then Directory.CreateDirectory(tmp)
Dim oExcel As Object
Dim oBook As Object
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add
oBook.worksheets(1).range("A1").select()
oBook.worksheets(1).paste()
System.Windows.Forms.Clipboard.Clear()
System.Windows.Forms.Clipboard.SetDataObject(t)
oBook.worksheets(1).range("A44").select()
oBook.worksheets(1).paste()
oBook.SaveAs(tmp & "\" & name & ".xls")
oExcel.Quit()
oExcel = Nothing
GC.Collect()
End Sub
the "Intellisence" feature of oExcel and oBook doesnt jump.
i.e. for oExcel Intellisence options are 5 methods (tostring, gettype etc..)
maybe is a declaration issue.. here are the declarations:
VB Code:
Imports system
Imports System.IO
Imports System.Data
Imports System.Data.SqlClient
Imports System.Windows.Forms
Imports GraphicsServer.GSNet.Charting
Imports GraphicsServer.GSNet.SeriesData
Imports System.Drawing
Imports Microsoft.Office
Imports Microsoft.Office.Interop
any idea why intellisence doesnt pop???
thanks in advance for suggestions
regards,
-j
Re: Office Automation.. where is intellisense hiding?
How about using :
VB Code:
Dim oExcel As Excel.Application = New Excel.Application
Dim oBook As Excel.Workbook
Normally the object created with CreateObject function didn't give intellisense.
Re: Office Automation.. where is intellisense hiding?
It'll still lack the explanation tooltips, just the members will be listed at least in 2003. Frustrating in a way.
Re: Office Automation.. where is intellisense hiding?
Quote:
Originally Posted by lingsn
How about using :
VB Code:
Dim oExcel As Excel.Application = New Excel.Application
Dim oBook As Excel.Workbook
Normally the object created with CreateObject function didn't give intellisense.
hey Lingsn,
your suggestion works very well. didnt know that CreateOBject doesnt include intellisence..
thanks so much.
Re: Office Automation.. where is intellisense hiding?
Quote:
Originally Posted by josephine
hey Lingsn,
your suggestion works very well. didnt know that CreateOBject doesnt include intellisence..
thanks so much.
It's not that you've used CreateObject, it's because you've typed the variables as Object. Object is the absolute generic type in .NET, it only has about 4 methods, that are common to all types as they all inherit from Object. Intellisense thus can only show those methods as it knows nothing more about the actual type, the interface binding is done at run time. This is known as late-binding and it's BAD. Avoid it wherever possible.
Re: [RESOLVED] Office Automation.. where is intellisense hiding?
Late binding is not bad at all. Take into account when you need to support multiple versions of Office or a different one then that what was used to create the app. ;)
Only via Early Binding can you get the intellisense popups.
Re: [RESOLVED] Office Automation.. where is intellisense hiding?
It's still bad, just occasionally unavoidable.
Re: [RESOLVED] Office Automation.. where is intellisense hiding?
But you havent presented a valid reason to avoid it. :D