MartyConnelly
martyconnelly at shaw.ca
Wed Apr 5 14:00:55 CDT 2006
dim outobj as Object Set outobj = CreateObject("outlook.application") or try specifying actual object version in your Get/CreateObject calls Set outobj = CreateObject ("Outlook.Application.9") 'For Outlook 2000 Set outobj = CreateObject ("Outlook.Application.11") 'For Outlook 2003 'you might want to use this type of code 'to check if outlook already running and whether you close it. Dim objOl as object On Error Resume Next blnOlRunning = True Set objOl = GetObject(, "Outlook.Application") If Err <> 0 Then 'Not running Set objOl = CreateObject("Outlook.Application") blnOlRunning = True Err.Clear End If On Error GoTo 0 '------blah blah If blnOlRunning = True Then ' display the new item objItem.Display Else objOl.Quit End If Joe Rojas wrote: >Thanks for the reply! > >If I were to use the CreateObject function, what would be the class name >that I would use? > >Thanks, >Joe Rojas >IT Manager >TNCO, Inc. >781-447-6661 x7506 >jrojas at tnco-inc.com > >-----Original Message----- >From: accessd-bounces at databaseadvisors.com >[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of MartyConnelly >Sent: Tuesday, April 04, 2006 7:36 PM >To: Access Developers discussion and problem solving >Subject: Re: [AccessD] Devoloping with A2K3 for an A2K environment > >Use late binding with CreateObject and maybe use a conditional compile >around Early and Late binding. > >or you could use this code to force a reference function on immediate >entry to the mdb if you are sure of the path. >and a similar delete of old reference. > >The first of the following two functions adds a reference to the >calendar control to the References collection. >The second function removes the reference to the calendar control. > >Function AddReference() As Boolean > Dim ref As Reference > dim strFile As String > > On Error GoTo Error_AddReference > strFile = "C:\Windows\System\Mscal.ocx" > ' Create reference to calendar control. > Set ref = References.AddFromFile(strFile) > AddReference = True > >Exit_AddReference: > Exit Function > >Error_AddReference: > MsgBox Err & ": " & Err.Description > AddReference = False > Resume Exit_AddReference >End Function > >Function RemoveReference() As Boolean > > Dim ref As Reference > > On Error GoTo Error_RemoveReference > Set ref = References!MSACAL > ' Remove calendar control reference. > References.Remove ref > RemoveReference = True > >Exit_RemoveReference: > Exit Function > >Error_RemoveReference: > MsgBox Err & ": " & Err.Description > RemoveReference = False > Resume Exit_RemoveReference >End Function > > > > >Function ReferenceFromFile(strFileName As String, _ > Optional Warning As Boolean) As Boolean >'ReferenceFromFile "c:\Windows\System\vbscript.dll\3" , True >' One caveat adding a reference this way forces a decompile >' so cannot be used in an MDE. At least not executed inside one to >' reset references. > > Dim ref As Access.Reference > > On Error GoTo Error_ReferenceFromFile > Set ref = References.AddFromFile(strFileName) > ReferenceFromFile = True > >Exit_ReferenceFromFile: > Exit Function > >Error_ReferenceFromFile: > If Warning = True Then VBA.MsgBox Err & ": " & Err.Description > ReferenceFromFile = False > Resume Exit_ReferenceFromFile >End Function >Joe Rojas wrote: > > > >>Hi All, >> >>I ran into a problem with installing Office 2003 Pro on my computer. >>I had created several databases with Access 2000, prior to my Office >>upgrade, which used the Outlook 9.0 (2000) object model. When I open >>these databases up, Access 2003 automatically changes the reference >> >> >from > > >>Outlook 9.0 to 11.0. >>When a user, using Office 2000, opens this database they have a missing >>reference! >> >>How do others on this list deal with this issue where you are using a >>newer version of Office to develop than the user's environment? >> >>Thanks, >>Joe Rojas >>IT Manager >>TNCO, Inc. >>781-447-6661 x7506 >>jrojas at tnco-inc.com >> >> >> >> >> > > > -- Marty Connelly Victoria, B.C. Canada