Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Closed Thread
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 20th, 2003, 08:19 AM
Registered User
 
Join Date: Aug 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Outlook

Hi,

I've been looking all around the web for some examples of using VB with Outlook, and I've found something strange. There seems to be two common ways of doing what looks like the same thing:

Method 1
Public Sub Application_Startup()
' initialization code
End Sub

Private Sub Application_NewMail()
' code to run when new mail arrives, using Application object
End Sub


Method 2
Dim WithEvents myOlApp As Outlook.Application

Public Sub Application_Startup()
Set myOlApp = CreateObject("Outlook.application")
' initialization code
End Sub

Private Sub myOlApp_NewMail()
' code to run when new mail arrives, using myOlApp object
End Sub


Can someone please tell me what the difference is between these two chunks of code and what reasons there are to prefer one over the other? (If it matters, I'm using Outlook 2000.) Thanks!


-E.D.
__________________
-E.D.
Closed Thread


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook jdhock8865 Beginning VB 6 3 July 9th, 2008 12:01 PM
Outlook magicroy Excel VBA 0 July 25th, 2007 09:56 AM
Using Outlook JAnthony Access VBA 0 May 18th, 2006 03:13 PM
VB6 Outlook help Glyphed Beginning VB 6 3 March 21st, 2006 06:00 AM
Outlook Help ksrmramu Classic ASP Components 0 August 22nd, 2005 07:28 AM



All times are GMT -4. The time now is 12:00 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.