473,378 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Late binding equivalent

Hi

What is the late binding equivalent of the below code?

Many Thanks

Regards
Dim O As Outlook.Application
Dim F As Outlook.MAPIFolder
Dim iCon As Outlook.ContactItem
Dim oContact As Outlook.ContactItem

O = New Outlook.Application

F =
O.Session.GetDefaultFolder(Outlook.OlDefaultFolder s.olFolderContacts)
oContact = DirectCast(F.Items.Item(1), Outlook.ContactItem)
oContact.Delete()

iCon = CType(F.Items().Add(Outlook.OlItemType.olContactIt em),
Outlook.ContactItem)
F.Items().Add(Outlook.OlItemType.olContactItem)

Feb 24 '06 #1
4 1400
CMM
Everything stays the same except:

1) All your "As xxxx" change to "As Object"
2) o = New Outlook.Application changes to o =
CreateObject("Outlook.Application")

And you get rid of the direct casts (since you can't cast to an object time
you don't know about).

Oh yeah, and Option Strict Off needs to be at the top of the module, I'm
pretty sure.
--
-C. Moya
www.cmoya.com
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:uV****************@TK2MSFTNGP11.phx.gbl...
Hi

What is the late binding equivalent of the below code?

Many Thanks

Regards
Dim O As Outlook.Application
Dim F As Outlook.MAPIFolder
Dim iCon As Outlook.ContactItem
Dim oContact As Outlook.ContactItem

O = New Outlook.Application

F =
O.Session.GetDefaultFolder(Outlook.OlDefaultFolder s.olFolderContacts)
oContact = DirectCast(F.Items.Item(1), Outlook.ContactItem)
oContact.Delete()

iCon = CType(F.Items().Add(Outlook.OlItemType.olContactIt em),
Outlook.ContactItem)
F.Items().Add(Outlook.OlItemType.olContactItem)

Feb 24 '06 #2
Getting error on Outlook.ContactItem on line below. How do I deal with this?

iCon = CType(F.Items().Add(2), Outlook.ContactItem)

Thanks

Regards

"CMM" <cm*@nospam.com> wrote in message
news:OD**************@TK2MSFTNGP14.phx.gbl...
Everything stays the same except:

1) All your "As xxxx" change to "As Object"
2) o = New Outlook.Application changes to o =
CreateObject("Outlook.Application")

And you get rid of the direct casts (since you can't cast to an object
time you don't know about).

Oh yeah, and Option Strict Off needs to be at the top of the module, I'm
pretty sure.
--
-C. Moya
www.cmoya.com
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:uV****************@TK2MSFTNGP11.phx.gbl...
Hi

What is the late binding equivalent of the below code?

Many Thanks

Regards
Dim O As Outlook.Application
Dim F As Outlook.MAPIFolder
Dim iCon As Outlook.ContactItem
Dim oContact As Outlook.ContactItem

O = New Outlook.Application

F =
O.Session.GetDefaultFolder(Outlook.OlDefaultFolder s.olFolderContacts)
oContact = DirectCast(F.Items.Item(1), Outlook.ContactItem)
oContact.Delete()

iCon = CType(F.Items().Add(Outlook.OlItemType.olContactIt em),
Outlook.ContactItem)
F.Items().Add(Outlook.OlItemType.olContactItem)


Feb 24 '06 #3
CMM
Sheesh. If the starting point I gave couldn't get you started, you really
shouldn't be programming. I mean, seriously...it seems that some really
really BASIC concepts are eluding you. You're basically looking for someone
to do it *for you*

Why are using CType? Do you know what it does? Stop trying to "cast." Same
goes for the constant "olContactItem." Find out what integer this represents
(um, research... use your wits) and use that in the place of the constant.

--
-C. Moya
www.cmoya.com
Feb 24 '06 #4
Actually I have already done it after your first post but before the second
post and just wanted to double check the small point. As you can see I had
already determined and used the constant. Thanks for the original post that
helped me to complete this successfully.

Regards

"CMM" <cm*@nospam.com> wrote in message
news:uR*************@TK2MSFTNGP09.phx.gbl...
Sheesh. If the starting point I gave couldn't get you started, you really
shouldn't be programming. I mean, seriously...it seems that some really
really BASIC concepts are eluding you. You're basically looking for
someone to do it *for you*

Why are using CType? Do you know what it does? Stop trying to "cast." Same
goes for the constant "olContactItem." Find out what integer this
represents (um, research... use your wits) and use that in the place of
the constant.

--
-C. Moya
www.cmoya.com

Feb 25 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Zlatko Matić | last post by:
I was reading about late binding, but I'm not completely sure what is to be done in order to adjust code to late binding... For example, I'm not sure if this is correct: early binding: Dim ws...
5
by: Daniel Bass | last post by:
..Net is great for modulerising libraries, so that all you need do to access a DLL, is simply call Add Reference and wallah, it's as though the library were written in your project. But what...
30
by: lgbjr | last post by:
hi All, I've decided to use Options Strict ON in one of my apps and now I'm trying to fix a late binding issue. I have 5 integer arrays: dim IA1(500), IA2(500), IA3(500), IA4(500), IA5(500) as...
4
by: John | last post by:
Hi What is the late binding equivalent of the below code? Many Thanks Regards Dim O As Outlook.Application
6
by: Stephany Young | last post by:
Using VS2005 and VB.NET and given a Windows Forms application with a single form (Form1) with 2 buttons (Button1 and Button2), I am attempting to instantiate an instance of Excel utilising late...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.