LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Object libraries and different ones with different versions

I have created a macro in word and it references the excel 11.0 object
library. My problem is the person I created it for runs excel 2000 and only
has the 9.0 object library. So everytime they run it, it crashes. I did
look at the article on late binding but I am not sure if I understand it
correctly. If I do take away the reference library how will the macro
understand some of my vlookups and stuff that is specific to excel? Here is
a sample of my code:

Public AppXL As Excel.Application

Sub client_count(filename)
' Macro A
'open excel client listing table and count number of accounts.


Dim xlntrn As Boolean
Dim lislrow As Long
Dim lokval As Integer
Dim clcnt As Integer
Dim cnttxt As String


On Error Resume Next
Set AppXL = CreateObject("Excel.application")

If Err Then
xlntrn = True
Set AppXL = New Application
End If

clcnt = 0


AppXL.Workbooks.Open ("C:\Model Pilot\Model Grid_SWI.xls")
AppXL.Workbooks.Open ("C:\Model Pilot\Names.xls")
AppXL.Workbooks.Open (filename)


Workbooks(filename).worksheets("Sheet1").Activate
With ActiveSheet
'get the last row of data for the ranges.

lislrow = AppXL.Cells(Rows.Count, "A").End(xlUp).Row

'sort data by lastname account number in listing excel file

Range("A2:Y" & lislrow).Sort Key1:=Range("G2"), Order1:=xlAscending,
Key2:=Range _
("A2"), Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1,
MatchCase _
:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal

For counter = 2 To lislrow

If counter 2 Then
If AppXL.Cells(counter, 1).Value = AppXL.Cells(counter - 1,
1).Value Then
GoTo Label1
End If
End If

If AppXL.Cells(counter, 26).Value = "Y" Then
GoTo Label1
End If

'lookup value
lokval = AppXL.Cells(counter, 15).Value


'row AE - col L of star
res = AppXL.vlookup(lokval, Workbooks("Model
Grid_SWI.xls").Sheets("Sheet1").Range("A2:M55"), 12, False)
If IsError(res) Then
AppXL.Cells(counter, 31).Value = ""
Else:
AppXL.Cells(counter, 31).Value = res
End If

clcnt = clcnt + 1#

Label1:
Next counter
End With


From what I read (but don't think I fully understand) this is how to late
bind it???

Public AppXL as object

and then the rest of the code would be the same or for every excel
function I use would I have to create another definition for excel.cells and
excel.vlookup and stuff?

Sorry but I find it hard to understand when they are using outlook as an
example. I wish I could understand better about what is included in late
binding for excel or does it not reference any of the excel references?

Maybe excel can include all library references with newer versions like
9.0, 10.0 and 11.0 and have someway of referencing the correct one based on
the version of excel the person is running. Just something to think of for
the next upgrade in excel it would be a nice feature especially with macros.

Thanks for any help in advance.
Heather
 
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 locating Object Libraries Ayo Excel Discussion (Misc queries) 2 November 6th 09 09:09 PM
Using Outlook Object Libraries V8 & 9 Kevin Excel Programming 2 April 21st 04 03:55 PM
DLL libraries msadox and msador15: Versions Problem No Name Excel Programming 2 December 1st 03 10:32 AM
DLL libraries msadox and msador15: Versions Problem No Name Excel Programming 0 November 29th 03 06:26 PM
Object libraries Lionel Fridjhon Excel Programming 9 August 29th 03 01:20 PM


All times are GMT +1. The time now is 02:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"