Thread
:
Outlook.application startup differences Outlook 200 vs 2003 Please help ;-)
View Single Post
#
3
July 18th 06, 03:24 PM posted to microsoft.public.outlook.program_vba
Dikbill
external usenet poster
Posts: 16
Outlook.application startup differences Outlook 200 vs 2003 Please help ;-)
Ken,
Thnx again.
I've tried the 'GetObject' method, sorry for not mentioning that in my
question,
and that seems to work because when an Outlook.exe is running, that
instance of Outlook is put in the variable which I use. olApplication
If no Outlook.exe is running a new one will be started, invisible.
Dim olApplication as object = Nothing
Try
olApplication = GetObject(, "Outlook.Application")
Catch
olApplication = New Outlook.Application
olApplication = CreateObject("Outlook.Application")
End Try
But then when I want to do the next:
Dim olns as object = olApplication.getNamespace("MAPI")
Then I get the error
Exception from HRESULT: 0x800A9C64
Do you have a clue???
Right now I'm re-installing office 2000, because maybe something has
become corrupt or something.
Tx,
Dikbill, The Netherlands
"Ken Slovak - [MVP - Outlook]" schreef in bericht
...
If you want Outlook visible when you don't have a UI you can add an
Explorer to the Explorers collection. Get a MAPIFolder object (like Inbox
for example) and use that object in the Add method of the Explorers
collection object. Make sure in those cases that you logon to the
NameSpace object.
Usually instead of New or CreateObject you would use GetObject to see
first if Outlook was running. Even if you do use New you can only have 1
instance of Outlook running so it should attach to that instance. Then a
check for Explorers.Count tells you if there is/was a UI.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"Dikbill" wrote in message
...
Hi there,
I'm creating a synchronisation program which wil synchronise
data between Outlook and our own database.
We want our program to work with Outlook 2000 and up.
The program is made with VB 2005 to communicate with a
standalone Outlook 2000/2003 Outlook client.
The problem I have is connecting with Outlook.
When the program starts, there can be 3 situations:
1. Outlook.exe isn't running
2. Outlook is running but invisible (Application.Explorers.Count=0)
3. Outlook is running visible
This is my startup code:
olApplication = New Outlook.Application
msgbox (olApplication.Version)
Now I discribe the above 3 situations from both Outlook 2000 and 2003
---Outlook 2003 situation
1-----------------------------------------------
Outlook is started but unvisible, that's not what I want.
The program starts with no errors, I can interact with Outlook.
---Outlook 2003 situation
2-----------------------------------------------
Outlook is started but unvisible, that's not what I want.
The program starts with no errors, I can interact with Outlook.
Every time when I start my program, a new instance of Outlook.exe
is started!! That's not what I want.
---Outlook 2003 situation
3-----------------------------------------------
Outlook not started again, that's good.
The program starts with no errors, I can interact with Outlook.
This is what I want!
---Outlook 2000 situation
1-----------------------------------------------
Outlook is started but unvisible, that's not what I want.
The program starts with no errors, I can interact with Outlook.
---Outlook 2000 situation
2-----------------------------------------------
Outlook isn't started, it will give the following error when it want's to
execute
the line msgbox (olApplication.Version)
System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2146788252
Message="Exception from HRESULT: 0x800A9C64"
Source="mscorlib"
StackTrace:
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32
culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags
bindingFlags, Binder binder, Object target, Object[] providedArgs,
ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at
Microsoft.VisualBasic.CompilerServices.VBBinder.In vokeMember(String name,
BindingFlags invokeAttr, Type objType, IReflect objIReflect, Object
target, Object[] args, String[] namedParameters)
at
Microsoft.VisualBasic.CompilerServices.LateBinding .LateGet(Object o, Type
objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack)
at
Microsoft.VisualBasic.CompilerServices.NewLateBind ing.LateGet(Object
Instance, Type Type, String MemberName, Object[] Arguments, String[]
ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
at Outlook_CRM_Sync.AGENDA_MAIN.Opstart() in
C:\TestDotNet\CRM_sync\Outlook_CRM_Sync\Outlook_CR M_Sync\AGENDA_MAIN.vb:line
41
at Outlook_CRM_Sync.AGENDA_MAIN.AGENDA_MAIN_Load(Obje ct sender,
EventArgs e) in
C:\TestDotNet\CRM_sync\Outlook_CRM_Sync\Outlook_CR M_Sync\AGENDA_MAIN.vb:line
23
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean
fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow( HandleRef
hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolea n value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Outlook_CRM_Sync.AGENDA_MAIN.Main() in
C:\TestDotNet\CRM_sync\Outlook_CRM_Sync\Outlook_CR M_Sync\AGENDA_MAIN.Designer.vb:line
2
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
at
Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
---Outlook 2000 situation
3-----------------------------------------------
Same as Outlook 2000 situation 2
What I am doing wrong????
Anyone??
Tx a lot,
Dikbill, The Netherlands
Dikbill
View Public Profile
View message headers
Find all posts by Dikbill
Find all threads started by Dikbill
Ads