Results 1 to 8 of 8

Thread: [RESOLVED] Office Automation.. where is intellisense hiding?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Location
    3rd rock from the sun
    Posts
    360

    Resolved [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:
    1. Private Sub Expo(ByVal t As String, ByVal name As String)
    2.         Dim tmp As String
    3.         tmp = "c:\Done Reports\" & Date.Today.ToString("MMM,dd") & "\" & Me.Name.ToString
    4.         If Directory.Exists(tmp) = False Then Directory.CreateDirectory(tmp)
    5.         Dim oExcel As Object
    6.         Dim oBook As Object
    7.         oExcel = CreateObject("Excel.Application")
    8.         oBook = oExcel.Workbooks.Add
    9.         oBook.worksheets(1).range("A1").select()
    10.         oBook.worksheets(1).paste()
    11.         System.Windows.Forms.Clipboard.Clear()
    12.         System.Windows.Forms.Clipboard.SetDataObject(t)
    13.         oBook.worksheets(1).range("A44").select()
    14.         oBook.worksheets(1).paste()
    15.         oBook.SaveAs(tmp & "\" & name & ".xls")
    16.         oExcel.Quit()
    17.         oExcel = Nothing
    18.         GC.Collect()
    19.     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:
    1. Imports system
    2. Imports System.IO
    3. Imports System.Data
    4. Imports System.Data.SqlClient
    5. Imports System.Windows.Forms
    6. Imports GraphicsServer.GSNet.Charting
    7. Imports GraphicsServer.GSNet.SeriesData
    8. Imports System.Drawing
    9. Imports Microsoft.Office
    10. Imports Microsoft.Office.Interop

    any idea why intellisence doesnt pop???

    thanks in advance for suggestions

    regards,
    -j

  2. #2
    Lively Member
    Join Date
    Nov 2006
    Posts
    116

    Re: Office Automation.. where is intellisense hiding?

    How about using :

    VB Code:
    1. Dim oExcel As Excel.Application = New Excel.Application
    2.         Dim oBook As Excel.Workbook

    Normally the object created with CreateObject function didn't give intellisense.

  3. #3
    Frenzied Member
    Join Date
    Mar 2005
    Location
    Sector 001
    Posts
    1,577

    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.
    VB 2005, Win Xp Pro sp2

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Location
    3rd rock from the sun
    Posts
    360

    Re: Office Automation.. where is intellisense hiding?

    Quote Originally Posted by lingsn
    How about using :

    VB Code:
    1. Dim oExcel As Excel.Application = New Excel.Application
    2.         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.

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  7. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [RESOLVED] Office Automation.. where is intellisense hiding?

    It's still bad, just occasionally unavoidable.

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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
  •  



Click Here to Expand Forum to Full Width