Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 121
Default Checking & installing references as part of on_open

I have a macro that access MS Outlook data from Excel (mixed platform, users
may be using Win2K or WinXP and O2K or OXP)

Is there a way, during the on_open procedure, to have the VBA code check for
a reference to outlook, and if there isn't one "check the box" to activate
the reference? What makes this more problematic is the multiple platforms,
so I'm not sure how to hardcode the multiple possible reference names. I am
sticking with early binding, because so far I haven't learned enough to make
late binding work (I've tried).

The idea of walking every user through the process of opening up the VBE,
adding the reference, etc. is daunting, so I'd like to do this automatically
if possible.

Many thanks,
Keith

--
The enclosed questions or comments are entirely mine and don't represent the
thoughts, views, or policy of my employer. Any errors or omissions are my
own.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Checking & installing references as part of on_open

Use late binding.

Dim oOLApp as Object

with

Set oConn = CreateObject("Outlook.Application")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"KR" wrote in message
...
I have a macro that access MS Outlook data from Excel (mixed platform,

users
may be using Win2K or WinXP and O2K or OXP)

Is there a way, during the on_open procedure, to have the VBA code check

for
a reference to outlook, and if there isn't one "check the box" to activate
the reference? What makes this more problematic is the multiple platforms,
so I'm not sure how to hardcode the multiple possible reference names. I

am
sticking with early binding, because so far I haven't learned enough to

make
late binding work (I've tried).

The idea of walking every user through the process of opening up the VBE,
adding the reference, etc. is daunting, so I'd like to do this

automatically
if possible.

Many thanks,
Keith

--
The enclosed questions or comments are entirely mine and don't represent

the
thoughts, views, or policy of my employer. Any errors or omissions are my
own.




  #3   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 121
Default Checking & installing references as part of on_open

I have tried late binding, but then I have all sorts of other problems
getting the rest of my outlook code to work (I'm not a programmer by
training or profession, I'm just learning as I go). Is there a web page
reference anywhere that shows how to take early binding code, and what needs
to be done to it, in order to make it work when late binding is used? I have
a basic notion of the difference between early and late binding, just not
the details of how to make it work.

Thanks,
Keith

"Bob Phillips" wrote in message
...
Use late binding.

Dim oOLApp as Object

with

Set oConn = CreateObject("Outlook.Application")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"KR" wrote in message
...
I have a macro that access MS Outlook data from Excel (mixed platform,

users
may be using Win2K or WinXP and O2K or OXP)

Is there a way, during the on_open procedure, to have the VBA code check

for
a reference to outlook, and if there isn't one "check the box" to

activate
the reference? What makes this more problematic is the multiple

platforms,
so I'm not sure how to hardcode the multiple possible reference names. I

am
sticking with early binding, because so far I haven't learned enough to

make
late binding work (I've tried).

The idea of walking every user through the process of opening up the

VBE,
adding the reference, etc. is daunting, so I'd like to do this

automatically
if possible.

Many thanks,
Keith

--
The enclosed questions or comments are entirely mine and don't represent

the
thoughts, views, or policy of my employer. Any errors or omissions are

my
own.






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Checking & installing references as part of on_open

I've just had a similar problem with a reference to MDAC, and late binding
did not solve the problem, it simply moved it from when the spreadsheet
opened to when the CreateObject call was made. Since the exeception was not
caught by On Error.., it was not possible to handle it cleanly.

JPL

"KR" wrote in message
...
I have a macro that access MS Outlook data from Excel (mixed platform,
users
may be using Win2K or WinXP and O2K or OXP)

Is there a way, during the on_open procedure, to have the VBA code check
for
a reference to outlook, and if there isn't one "check the box" to activate
the reference? What makes this more problematic is the multiple platforms,
so I'm not sure how to hardcode the multiple possible reference names. I
am
sticking with early binding, because so far I haven't learned enough to
make
late binding work (I've tried).

The idea of walking every user through the process of opening up the VBE,
adding the reference, etc. is daunting, so I'd like to do this
automatically
if possible.

Many thanks,
Keith

--
The enclosed questions or comments are entirely mine and don't represent
the
thoughts, views, or policy of my employer. Any errors or omissions are my
own.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Checking & installing references as part of on_open

I have given a worked example before, you can see it at
http://tinyurl.com/2qern
--

HTH

RP
(remove nothere from the email address if mailing direct)


"KR" wrote in message
...
I have tried late binding, but then I have all sorts of other problems
getting the rest of my outlook code to work (I'm not a programmer by
training or profession, I'm just learning as I go). Is there a web page
reference anywhere that shows how to take early binding code, and what

needs
to be done to it, in order to make it work when late binding is used? I

have
a basic notion of the difference between early and late binding, just not
the details of how to make it work.

Thanks,
Keith

"Bob Phillips" wrote in message
...
Use late binding.

Dim oOLApp as Object

with

Set oConn = CreateObject("Outlook.Application")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"KR" wrote in message
...
I have a macro that access MS Outlook data from Excel (mixed platform,

users
may be using Win2K or WinXP and O2K or OXP)

Is there a way, during the on_open procedure, to have the VBA code

check
for
a reference to outlook, and if there isn't one "check the box" to

activate
the reference? What makes this more problematic is the multiple

platforms,
so I'm not sure how to hardcode the multiple possible reference names.

I
am
sticking with early binding, because so far I haven't learned enough

to
make
late binding work (I've tried).

The idea of walking every user through the process of opening up the

VBE,
adding the reference, etc. is daunting, so I'd like to do this

automatically
if possible.

Many thanks,
Keith

--
The enclosed questions or comments are entirely mine and don't

represent
the
thoughts, views, or policy of my employer. Any errors or omissions are

my
own.










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Checking & installing references as part of on_open

What error was not caught?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"JPL" <j.p.lxdsl.pipex.com wrote in message
...
I've just had a similar problem with a reference to MDAC, and late binding
did not solve the problem, it simply moved it from when the spreadsheet
opened to when the CreateObject call was made. Since the exeception was

not
caught by On Error.., it was not possible to handle it cleanly.

JPL

"KR" wrote in message
...
I have a macro that access MS Outlook data from Excel (mixed platform,
users
may be using Win2K or WinXP and O2K or OXP)

Is there a way, during the on_open procedure, to have the VBA code check
for
a reference to outlook, and if there isn't one "check the box" to

activate
the reference? What makes this more problematic is the multiple

platforms,
so I'm not sure how to hardcode the multiple possible reference names. I
am
sticking with early binding, because so far I haven't learned enough to
make
late binding work (I've tried).

The idea of walking every user through the process of opening up the

VBE,
adding the reference, etc. is daunting, so I'd like to do this
automatically
if possible.

Many thanks,
Keith

--
The enclosed questions or comments are entirely mine and don't represent
the
thoughts, views, or policy of my employer. Any errors or omissions are

my
own.






  #7   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 121
Default Checking & installing references as part of on_open

Bob- this example was very helpful to get me started.

When using late binding, I'm having trouble converting the namespaces (if
that means what I think it means); While this is partly re-using the code
from intellisense (with early binding/ references on), I'm not sure how to
identify by myself what should go in the quotes after each statement. Any
advice would be greatly appreciated.

'for late binding:
Dim olApp As Object
Dim olNs As Object
Dim olFldr As Object
Dim olApt As Object

Set olApp = CreateObject("Outlook.Application")
Set olNs = olApp.GetNamespace("MAPI")
Set olFldr = olNs.MAPIFolder '<---- it stops here, error 438 unsupported
property or method
Set olApt = olFldr.AppointmentItem

My goal is to be able to cycle through all appointments and identify the
ones with "Vacation" in the subject line (using olApt.Subject), then I grab
the olApt.Start and olApt.Duration. I'm not sure if I can access these last
three on the fly, or if I need to Dim them as objects as well?

Many thanks,
Keith


"Bob Phillips" wrote in message
...
I have given a worked example before, you can see it at
http://tinyurl.com/2qern
--

HTH

RP
(remove nothere from the email address if mailing direct)


"KR" wrote in message
...
I have tried late binding, but then I have all sorts of other problems
getting the rest of my outlook code to work (I'm not a programmer by
training or profession, I'm just learning as I go). Is there a web page
reference anywhere that shows how to take early binding code, and what

needs
to be done to it, in order to make it work when late binding is used? I

have
a basic notion of the difference between early and late binding, just

not
the details of how to make it work.

Thanks,
Keith

"Bob Phillips" wrote in message
...
Use late binding.

Dim oOLApp as Object

with

Set oConn = CreateObject("Outlook.Application")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"KR" wrote in message
...
I have a macro that access MS Outlook data from Excel (mixed

platform,
users
may be using Win2K or WinXP and O2K or OXP)

Is there a way, during the on_open procedure, to have the VBA code

check
for
a reference to outlook, and if there isn't one "check the box" to

activate
the reference? What makes this more problematic is the multiple

platforms,
so I'm not sure how to hardcode the multiple possible reference

names.
I
am
sticking with early binding, because so far I haven't learned enough

to
make
late binding work (I've tried).

The idea of walking every user through the process of opening up the

VBE,
adding the reference, etc. is daunting, so I'd like to do this
automatically
if possible.

Many thanks,
Keith

--
The enclosed questions or comments are entirely mine and don't

represent
the
thoughts, views, or policy of my employer. Any errors or omissions

are
my
own.










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
Checking cells for part of a text string RoryDM Excel Worksheet Functions 2 October 10th 09 09:47 AM
Spell Checking with checking cell notes jfitzpat Excel Discussion (Misc queries) 0 August 8th 07 10:26 PM
Can references to cells be used as part of a workbook reference blackreugen Excel Discussion (Misc queries) 1 April 18th 06 08:01 PM
Auto_open or On_open Nathan Gutman Excel Programming 1 December 5th 03 09:21 PM
On_Open color coding Phil Hageman Excel Programming 3 August 7th 03 11:18 PM


All times are GMT +1. The time now is 12:14 AM.

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"