Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Object Library problem

Problem is like this: I've made a system, where one user fills in the title
area of a worksheet and system sends an e-mail to selected user. After that
the other user fills in the rest of the worksheet and press 'Ready'-button,
which sends again an e-mail to the user, who originally filled in the title
area. System works ok, but if these two users have different version of Excel
(e.g. 2000 and 2003), then the newer version changes the version of Microsoft
Outlook Object Library (Tools / References in Visual Basic Editor) and after
that the older version can't open the file (gives an error message). Is it
possible to set appropriate version of Object Library programmatically
instead of choosing Tools / References command in Visual Basic Editor and
selecting Object Library there?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Object Library problem

Sounds like you are using early binding (adding the reference at design time
instead of run time). Change to late binding something like this...

dim appOutLook as object

set appOutLook = CreateObject("OutLook.Application")

Now you are not hooked into any specific version of OutLook...
--
HTH...

Jim Thomlinson


"djExcel" wrote:

Problem is like this: I've made a system, where one user fills in the title
area of a worksheet and system sends an e-mail to selected user. After that
the other user fills in the rest of the worksheet and press 'Ready'-button,
which sends again an e-mail to the user, who originally filled in the title
area. System works ok, but if these two users have different version of Excel
(e.g. 2000 and 2003), then the newer version changes the version of Microsoft
Outlook Object Library (Tools / References in Visual Basic Editor) and after
that the older version can't open the file (gives an error message). Is it
possible to set appropriate version of Object Library programmatically
instead of choosing Tools / References command in Visual Basic Editor and
selecting Object Library there?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Object Library problem

Thank You for Your answer.

Now I'm using code like this, and it's working:

Sub DoMail(MailAddress As String)
Dim AppMail As Object
Set AppMail = CreateObject("OutLook.Application")
With AppMail.CreateItem(olMailItem)
.To = MailAddress
.Subject = "Work is ready"
.Body = "Check the worksheet for results."
.Send
End With
Set AppMail = Nothing
End Sub

Is this same kind of technique possible when using ADO connection to SQL
Server? Here is a sample code that I'm currently using (which requires me to
select Microsoft ActiveX Data Objects Library in advance (Tools /
References)):

Public cnADO As ADODB.Connection
Public Rs1 As ADODB.Recordset
Public strConn As String

Sub DoConnection()
Set cnADO = New ADODB.Connection
strConn = "provider=sqloledb;" & _
"data source=xxx;" & _
"initial catalog=xxx;" & _
"user id=xxx;" & _
"password=xxx;"
cnADO.Open strConn
End Sub

Sub Main_program()
DoConnection
Set Rs1 = New ADODB.Recordset
Rs1.ActiveConnection = cnADO
Rs1.Open "SELECT * FROM ..."
...
End Sub
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Object Library problem


"djExcel" wrote in message
...
Thank You for Your answer.

Now I'm using code like this, and it's working:

Sub DoMail(MailAddress As String)
Dim AppMail As Object
Set AppMail = CreateObject("OutLook.Application")
With AppMail.CreateItem(olMailItem)
.To = MailAddress
.Subject = "Work is ready"
.Body = "Check the worksheet for results."
.Send
End With
Set AppMail = Nothing
End Sub



You c an't use olMailItem as that is an Outlook constant in the Outlook type
library.

Use

With AppMail.CreateItem(0)


Is this same kind of technique possible when using ADO connection to SQL
Server? Here is a sample code that I'm currently using (which requires me

to
select Microsoft ActiveX Data Objects Library in advance (Tools /
References)):

Public cnADO As ADODB.Connection
Public Rs1 As ADODB.Recordset
Public strConn As String

Sub DoConnection()
Set cnADO = New ADODB.Connection
strConn = "provider=sqloledb;" & _
"data source=xxx;" & _
"initial catalog=xxx;" & _
"user id=xxx;" & _
"password=xxx;"
cnADO.Open strConn
End Sub

Sub Main_program()
DoConnection
Set Rs1 = New ADODB.Recordset
Rs1.ActiveConnection = cnADO
Rs1.Open "SELECT * FROM ..."
...
End Sub



Sub DoConnection()
Set cnADO = CreateObject("ADODB.Connection")
strConn = "provider=sqloledb;" & _
"data source=xxx;" & _
"initial catalog=xxx;" & _
"user id=xxx;" & _
"password=xxx;"
cnADO.Open strConn
End Sub

Sub Main_program()
DoConnection
Set Rs1 = CreateObject("ADODB.Recordset")
Rs1.ActiveConnection = cnADO
Rs1.Open "SELECT * FROM ..."
...
End Sub



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Object Library problem

Thank You. Now I got the idea.
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
Help with Object Library Ayo Setting up and Configuration of Excel 1 November 6th 09 08:04 PM
WMI OBJECT LIBRARY RAFAAJ2000[_2_] Excel Programming 5 May 3rd 06 11:23 AM
MS Object library Thor Excel Programming 2 November 5th 04 11:46 PM
Object Library 11.0 GP Excel Programming 1 February 25th 04 01:12 PM
Problem with the Excel 10.0 Object Library MattEdwards Excel Programming 4 December 9th 03 12:37 AM


All times are GMT +1. The time now is 07:11 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"