Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable Types

Status
Not open for further replies.

sha76

Programmer
Sep 2, 2002
5,085
GB
Hi,

I'm trying to make my code a bit more efficient, I've got a few variables (in red) dimensioned as objects & was wondering if there were proper types for these?

Code:
Set
fso =
Code:
CreateObject("Scripting.FileSystemObject")


Set ol = Outlook.Application
Set olns = ol.GetNamespace("MAPI")
Set
objAllFolders
Code:
 = olns.Folders("Public Folders")
Set
objPublicFolders
Code:
 = objAllFolders.Folders("All Public Folders")

Cheers

Sharon
 
First, you need to add the Microsoft Scripting Runtime library to your References, if it isn't there already.

Then you can use the Object Browser to look up the types of properties and the result types of method calls, to get their class names.

If you use a Reference, you don't need to use CreateObject--use New instead. CreateObject returns an Object, and involves late binding. New allows early binding.
Dim fso As Scripting.FileSystemObject
Set fso = New Scripting.FileSystemObject

Likewise, since you already have Outlook in your References, you can look in the Object Browser to find the property types.
Dim objAllFolders As Scripting.Folders
Dim objPublicFolders As Scripting.Folders Rick Sprague
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
Cheers Rick,

That's made a noticeable difference to my application's speed. I found out it was MAPIfolder I needed for my Outlook folders.

Sharon
 
Of course! I should have realized you needed MAPIFolder, when using Outlook's GetNamespace. I wasn't looking for logic errors, only the ProgIDs for the objects you were using. Glad you figured it out. Rick Sprague
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top