|
-
Nov 30th, 2006, 06:07 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Office Automation.. where is intellisense hiding?
howzit guys.. 
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
-
Nov 30th, 2006, 06:31 AM
#2
Lively Member
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.
-
Nov 30th, 2006, 06:35 AM
#3
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.
-
Dec 1st, 2006, 12:54 PM
#4
Thread Starter
Hyperactive Member
Re: Office Automation.. where is intellisense hiding?
 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.
-
Dec 1st, 2006, 12:59 PM
#5
Re: Office Automation.. where is intellisense hiding?
 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.
-
Dec 1st, 2006, 01:02 PM
#6
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.
Last edited by RobDog888; Dec 1st, 2006 at 01:06 PM.
Reason: type-o
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Dec 1st, 2006, 01:03 PM
#7
Re: [RESOLVED] Office Automation.. where is intellisense hiding?
It's still bad, just occasionally unavoidable.
-
Dec 1st, 2006, 01:09 PM
#8
Re: [RESOLVED] Office Automation.. where is intellisense hiding?
But you havent presented a valid reason to avoid it.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|