Can't even capture if Outlook is running

  • Thread starter Thread starter Lester Lane
  • Start date Start date
L

Lester Lane

Hi,
I have upgraded to 2010 and when Access is running my code it won't
even detect if Outlook 2010 is running nor will
it create a new instance (failed with a 429 - ActiveX can't create
error).

I also remember that using 2010 one can pick an account to send
through and I
guess the whole routine could be made slicker. I'm at a loss even
using the "help" screens. Thanks.

Dim objOutlook As Object ' Note: Must be late-binding.
Dim objNameSpace As Object
Dim objExplorer As Object
Dim blnSuccessful As Boolean
Dim blnNewInstance As Boolean
Dim strFailed As String
Dim i As Integer

'Is an instance of Outlook already open that we can bind to?
On Error Resume Next
Set objOutlook = GetObject(, "Outlook.Application") ==== fails to find
running program
On Error GoTo ErrTrap

If objOutlook Is Nothing Then

'Outlook isn't already running - create a new instance...
Set objOutlook = CreateObject("Outlook.Application") ==== fails
with 429 can't create error
blnNewInstance = True
'We need to instantiate the Visual Basic environment... (messy)
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objExplorer =
objOutlook.Explorers.Add(objNameSpace.Folders(1), 0)
objExplorer.CommandBars.FindControl(, 1695).Execute

objExplorer.Close

Set objNameSpace = Nothing
Set objExplorer = Nothing

End If
......... more code .......

I also had some code in Outlook 2003 that allowed me to bypass the
annoying messages when I sent emails from Access 2003. Do I still
need this or has Outlook improved since 2003 re thinking it is under
attack?!
 
Is this Access/Outlook 32 or 64 bit?

I haven't tested running any Outlook automation code from Access in 2010,
but one of the Access MVP's was posting in this group in a thread titled
"Problem automating Outlook in Windows 7 from VB6 and Access" about a
problem with VB6 code and Outlook automation. You might want to look at that
thread and see if Tony's batch file workaround has any effect on your
situation.
 
Is this Access/Outlook 32 or 64 bit?

I haven't tested running any Outlook automation code from Access in 2010,
but one of the Access MVP's was posting in this group in a thread titled
"Problem automating Outlook in Windows 7 from VB6 and Access" about a
problem with VB6 code and Outlook automation. You might want to look at that
thread and see if Tony's batch file workaround has any effect on your
situation.

Thanks for the pointer to a nightmare of a problem! It seems like it
might be similar but Tony was having issues with Access if it was
triggered by a VB6 program/batch file. If Access was run from
Explorer then things seemed to work. My problem is that Access, run
normally, will not even pick up that Outlook is running using
GetObject(, "Outlook.Application") as it remains equal to Nothing.
Maybe my issues are security driven as I have not played (lowered)
theses settings yet can you let me know what I should be making sure
is set? Thanks a lot.

James
 
You didn't answer my question, is this 32 or 64 bit Access and Outlook?

Do you have up-to-date anti-virus software running? Under most circumstances
now with up-to-date anti-virus software running the old object model guard
is disabled and you can run standalone code with no problems. For security
settings you have to look at the Trust Center settings, I don't have Outlook
or Access 2010 open here right now but check the settings for macros and
macro code.

Another possible problem is anti-virus software. Some of them have script
stoppers. If you are running a product like that you may be out of luck,
some don't let you trust anything (Norton) while others do allow you to
trust code (McAfee). If a script stopper is doing that you're out of luck
unless you can tell it to trust the code or you uninstall it and reinstall
without the script stopper.




<snip>
Thanks for the pointer to a nightmare of a problem! It seems like it
might be similar but Tony was having issues with Access if it was
triggered by a VB6 program/batch file. If Access was run from
Explorer then things seemed to work. My problem is that Access, run
normally, will not even pick up that Outlook is running using
GetObject(, "Outlook.Application") as it remains equal to Nothing.
Maybe my issues are security driven as I have not played (lowered)
theses settings yet can you let me know what I should be making sure
is set? Thanks a lot.

James
 
Do you have up-to-date anti-virus software running? Under most circumstances
now with up-to-date anti-virus software running the old object model guard
is disabled and you can run standalone code with no problems.

Oh, is that what has caused the change with Outlook. I didn't realize
that current anti-virus software was the reason.
Another possible problem is anti-virus software. Some of them have script
stoppers. If you are running a product like that you may be out of luck,
some don't let you trust anything (Norton) while others do allow you to
trust code (McAfee). If a script stopper is doing that you're out of luck
unless you can tell it to trust the code or you uninstall it and reinstall
without the script stopper.

Access code isn't really a scripting language though.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
 
No, but Norton intercepts GetObject() and CreateObject() calls and can
disable them. Even if the code is actually VBA or even VB6 Norton will get
it's greasy hands into the mix and screw everything up. Not just Norton of
course, they're just the worst. Any script stopper can do that.
 
No, but Norton intercepts GetObject() and CreateObject() calls and can
disable them. Even if the code is actually VBA or even VB6 Norton will get
it's greasy hands into the mix and screw everything up. Not just Norton of
course, they're just the worst. Any script stopper can do that.

Ahhh, I was unaware of that.

Thanks, Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
 
Back
Top