Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Programming involving applications other than Excel

All,

My Excel VBA programming is decent enough when I stay within Excel.
However, I'm trying to expand my knowledge base and frequently I wish
I could better interact with other Office programs, such as Outlook.
Here's a piece of code that works great but I don't fully understand.

Private Sub UserForm_Activate()

Dim x As Integer

Set objOL = CreateObject("Outlook.Application")
Set olNS = objOL.GetNamespace("MAPI")
Set myFolder = olNS.GetDefaultFolder(10)
Set myItems = myFolder.Items

myItems.Sort "FullName"

x = 0
For Each myContact In myItems
If TypeName(myContact) = "ContactItem" Then
If Len(myContact.Email1DisplayName) 0 Then
ListBox1.AddItem
ListBox1.Column(0, x) = myContact.Email1DisplayName
ListBox1.Column(1, x) = myContact.Email1Address
x = x + 1
End If
End If
Next myContact

Set olNS = Nothing
Set objOL = Nothing

End Sub

My basic question is this: Can anyone suggest a good reference to
learn the uses and codes associated with objects, variables,
constants, etc..., which relate to programs outside Excel? For
example, in the above code I do not understand the precise usage of
GetNamespace("MAPI"), GetDefaultFolder(10), myFolder.Items,
Email1DisplayName, Email1Address, etc..., etc...

I don't like using code I don't understand for many obvious reasons.
Clearly, Email1DisplayName is a particular field in the OL Address
Book, but how do I learn what all of these fields are called? Where do
I obtain syntax info for Outlook Object references? Etc.., Etc....I
think you'll all get what I'm asking.

Thanks, everyone!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Programming involving applications other than Excel

There are a couple of ways to learn what these things mean. One is to go to
a book store like Barnes & Noble or on line to Amazon.Com and buy a book
that deals with it. The other is to open the Visual Basic Editor in each of
the applications that you are dealing with and type in the questionable
constants, keywords, methods, etc. that you want more information on and
read the associated help file. For instance, I went to Outlook VBE and
typed in GetNameSpace and it gave me a pick list with that method listed.
Selecting that option from the pick list, it gives a description of the
method and an example of how to use it. Or you can keep asking questions in
this forum.


"A Mad Doberman" wrote in message
...
All,

My Excel VBA programming is decent enough when I stay within Excel.
However, I'm trying to expand my knowledge base and frequently I wish
I could better interact with other Office programs, such as Outlook.
Here's a piece of code that works great but I don't fully understand.

Private Sub UserForm_Activate()

Dim x As Integer

Set objOL = CreateObject("Outlook.Application")
Set olNS = objOL.GetNamespace("MAPI")
Set myFolder = olNS.GetDefaultFolder(10)
Set myItems = myFolder.Items

myItems.Sort "FullName"

x = 0
For Each myContact In myItems
If TypeName(myContact) = "ContactItem" Then
If Len(myContact.Email1DisplayName) 0 Then
ListBox1.AddItem
ListBox1.Column(0, x) = myContact.Email1DisplayName
ListBox1.Column(1, x) = myContact.Email1Address
x = x + 1
End If
End If
Next myContact

Set olNS = Nothing
Set objOL = Nothing

End Sub

My basic question is this: Can anyone suggest a good reference to
learn the uses and codes associated with objects, variables,
constants, etc..., which relate to programs outside Excel? For
example, in the above code I do not understand the precise usage of
GetNamespace("MAPI"), GetDefaultFolder(10), myFolder.Items,
Email1DisplayName, Email1Address, etc..., etc...

I don't like using code I don't understand for many obvious reasons.
Clearly, Email1DisplayName is a particular field in the OL Address
Book, but how do I learn what all of these fields are called? Where do
I obtain syntax info for Outlook Object references? Etc.., Etc....I
think you'll all get what I'm asking.

Thanks, everyone!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Programming involving applications other than Excel

On Mar 11, 10:39*am, "JLGWhiz" wrote:
There are a couple of ways to learn what these things mean. *One is to go to
a book store like Barnes & Noble or on line to Amazon.Com and buy a book
that deals with it. *The other is to open the Visual Basic Editor in each of
the applications that you are dealing with and type in the questionable
constants, keywords, methods, etc. that you want more information on and
read the associated help file. *For instance, I went to Outlook VBE and
typed in GetNameSpace and it gave me a pick list with that method listed.
Selecting that option from the pick list, it gives a description of the
method and an example of how to use it. *Or you can keep asking questions in
this forum.

"A Mad Doberman" wrote in ...



All,


My Excel VBA programming is decent enough when I stay within Excel.
However, I'm trying to expand my knowledge base and frequently I wish
I could better interact with other Office programs, such as Outlook.
Here's a piece of code that works great but I don't fully understand.


Private Sub UserForm_Activate()


Dim x As Integer


Set objOL = CreateObject("Outlook.Application")
Set olNS = objOL.GetNamespace("MAPI")
Set myFolder = olNS.GetDefaultFolder(10)
Set myItems = myFolder.Items


myItems.Sort "FullName"


x = 0
For Each myContact In myItems
* *If TypeName(myContact) = "ContactItem" Then
* * * *If Len(myContact.Email1DisplayName) 0 Then
* * * *ListBox1.AddItem
* * * *ListBox1.Column(0, x) = myContact.Email1DisplayName
* * * *ListBox1.Column(1, x) = myContact.Email1Address
* * * *x = x + 1
* * * *End If
* *End If
Next myContact


Set olNS = Nothing
Set objOL = Nothing


End Sub


My basic question is this: Can anyone suggest a good reference to
learn the uses and codes associated with objects, variables,
constants, etc..., which relate to programs outside Excel? For
example, in the above code I do not understand the precise usage of
GetNamespace("MAPI"), GetDefaultFolder(10), myFolder.Items,
Email1DisplayName, Email1Address, etc..., etc...


I don't like using code I don't understand for many obvious reasons.
Clearly, Email1DisplayName is a particular field in the OL Address
Book, but how do I learn what all of these fields are called? Where do
I obtain syntax info for Outlook Object references? Etc.., Etc....I
think you'll all get what I'm asking.


Thanks, everyone!- Hide quoted text -


- Show quoted text -


Thanks! I can't believe I didn't think to look in the VBA help files
in the other applications!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 question involving SaveAs to .XLS Kirk Bubul Excel Discussion (Misc queries) 3 October 17th 09 03:01 PM
Excel crash when doing OpenXML, apparently involving DisplayAlerts [email protected] Excel Programming 0 March 30th 07 04:08 PM
Bug in Excel 2003 involving ActiveX Controls on worksheets joeeng Excel Programming 6 February 1st 07 02:25 PM
Complex Excel Problem involving Step Costs jcc Excel Worksheet Functions 3 March 15th 06 10:15 PM
Complex problem involving VBA in excel FloggingDolphin Excel Programming 2 June 30th 05 09:49 PM


All times are GMT +1. The time now is 11:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"