+ Reply to Thread
Results 1 to 4 of 4

Do data types (integer, string, etc.) show up anywhere in the object browser?

Hybrid View

  1. #1
    Registered User
    Join Date
    07-10-2013
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    77

    Do data types (integer, string, etc.) show up anywhere in the object browser?

    If not, why don't they?

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Do data types (integer, string, etc.) show up anywhere in the object browser?

    They do.

    Change the library to VBA specifically. They're members of the vbVarType class. If you disable online connectivity, F1 will pop a useful list of all the types.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Registered User
    Join Date
    07-10-2013
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    77

    Re: Do data types (integer, string, etc.) show up anywhere in the object browser?

    Quote Originally Posted by daffodil11 View Post
    They do.

    Change the library to VBA specifically. They're members of the vbVarType class. If you disable online connectivity, F1 will pop a useful list of all the types.
    Why are the data types assigned to a random constant? Ex: vbBoolean = 11 and vbLong = 3

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Do data types (integer, string, etc.) show up anywhere in the object browser?

    The values are for use in Late Binding. If you reference the correct library (think translation guide) when building your project, you're using Early Binding. The Intellisense helps you code as your write.

    Late Binding on the other hand, doesn't reference a library at all, but instead relies on the constant values to declare what you're talking about. Intellisense won't help as you go and it's kind of less user friendly, but more universal at the same time. If the recipient of your code didn't have the library intrinsics you reference, then the code would fail. However, the constant values will not.

    I most commonly run into Late vs Early Binding when automating email from Excel or Access.

    For example:

    Late Bound
    Dim OutApp As Object
    Dim OutMail As Object
    
    Set OutMail = OutApp.CreateItem(0)
    Early Bound
    Dim olNewApp As Outlook.Application
    Dim olNewMail As Outlook.MailItem
    
    Set olNewMail = olNewApp.CreateItem(olMailItem)
    If I tried the run the second code bit without referencing Outlook, it would fail. The first works, because it calls a mail object by referencing it's constant value 0, instead of by the super user friendly olMailItem.



    I've never had to give someone a serious project off my network, but if I was going to I'd probably go through and use as many constant values in place of instrinsics afterward and comment heavily throughout. This makes the code more stable in with regards to future MS Office updates and compatibility with various versions.
    Last edited by daffodil11; 07-10-2015 at 06:10 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 06-19-2014, 02:09 PM
  2. [SOLVED] how to identify string and integer within one piece of data
    By jakeembx in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-02-2014, 12:29 PM
  3. [SOLVED] Formatting Cell to show integer value when used with a string
    By Didley in forum Excel General
    Replies: 2
    Last Post: 11-29-2013, 10:46 AM
  4. Pivot to show two data types
    By brad_x81 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 11-16-2012, 07:20 AM
  5. object Browser
    By ampm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-04-2005, 03:59 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1