Share via

Excel Object Library 10.0 vs 11.0 version

Anonymous
2012-01-06T08:16:45+00:00

Dear,

I have 2003 xls file which is saved on a web share point. File combines vbs functionalities, of which one is uploading data to this file (from another file on the same share point) by clicking command button.

When I open file from my location it all functionalities are working without problems.

My customer is running it from his location, he is also using Excel 2003, the moment he wants to upload the data he gets the bug.

Message: Method "Worksheets" of object "_Global" failed

I checked and it seems that in the references he has 10.0 object library and I have 11.0

What i can do to unify the coding so it is indifferent from Object Library version?

Pls see coding below (in bold where it is currently buging)


Private Sub CommandButton1_Click() 'AP_AR upload

' data upload from Oracle AP_AR_TOTALS file

r = 7

r1 = 5

currWorkbook = ThisWorkbook.Name

sFolder = Worksheets("Welcome").TextBox3.Value

fName = "AP_AR_TOTALS.xls" 'name of AP_AR total file

sorceLocation = "http://infoshare.common.eu.corp.toyota.com/VAT/" & "TGB" & "/CURRENTMONTH/Shared%20Documents/" & "AP_AR_TOTALS.xls"

If CommandButton3 = False Then

Application.Workbooks.Open Filename:=sorceLocation 'AP_AR total file activation

Do While Workbooks(fName).Worksheets("AP_AR_TOTALS").Cells(r, 7) <> "END" 'adjust tab name !!!!

        Workbooks(currWorkbook).Worksheets("Tax Master Tab").Cells(r1, 1) = Workbooks(fName).Worksheets("AP_AR_TOTALS").Cells(r, 1)

        Workbooks(currWorkbook).Worksheets("Tax Master Tab").Cells(r1, 2) = Workbooks(fName).Worksheets("AP_AR_TOTALS").Cells(r, 2)

        Workbooks(currWorkbook).Worksheets("Tax Master Tab").Cells(r1, 3) = Workbooks(fName).Worksheets("AP_AR_TOTALS").Cells(r, 3)

        Workbooks(currWorkbook).Worksheets("Tax Master Tab").Cells(r1, 4) = Workbooks(fName).Worksheets("AP_AR_TOTALS").Cells(r, 4)

        Workbooks(currWorkbook).Worksheets("Tax Master Tab").Cells(r1, 5) = Workbooks(fName).Worksheets("AP_AR_TOTALS").Cells(r, 5)

        Workbooks(currWorkbook).Worksheets("Tax Master Tab").Cells(r1, 6) = Workbooks(fName).Worksheets("AP_AR_TOTALS").Cells(r, 6)

        r1 = r1 + 1

        Workbooks(currWorkbook).Worksheets("Tax Master Tab").Rows(r1).EntireRow.Insert

        r = r + 1

Loop

        Workbooks(currWorkbook).Worksheets("Recon.").Cells(2, 1) = Workbooks(fName).Worksheets("AP_AR_TOTALS").Cells(2, 4)

        Workbooks(currWorkbook).Worksheets("Recon.").Cells(4, 1) = Workbooks(fName).Worksheets("AP_AR_TOTALS").Cells(3, 4)

End If

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. Andreas Killer 144.1K Reputation points Volunteer Moderator
    2012-01-09T11:10:02+00:00

    If you give me your email I can send it as attachement.

    You can find my e-mail address in my profile.

    Andreas.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2012-01-09T08:45:53+00:00

    Currently I can not as this web is banded in my work enviroment

    I did not set any referencess, it was already pre-set.

    If you give me your email I can send it as attachement.

    Jakub

    Was this answer helpful?

    0 comments No comments
  3. Andreas Killer 144.1K Reputation points Volunteer Moderator
    2012-01-09T08:09:48+00:00

    When I check my referencess, I have a 11.0 as set library, the poit is that i can not change it for 10.0 as it does not exist in my ref.

    That is not the point, the reference to the librarys are set depending on the GUID.

    Your PC refers to version 11 because you have Excel 2003, your customer refers to 10, because he has Excel 2002. That is usual and not the problem.

    Again: Which reference did you set manually? Can you upload the workbook on a online filehoster, e.g. www.dropbox.com?

    Andreas.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2012-01-09T07:32:40+00:00

    I checked and it seems that in the references he has 10.0 object library and I have 11.0

    What i can do to unify the coding so it is indifferent from Object Library version?

    Pls see coding below (in bold where it is currently buging)

    IMHO this is not the reason for your problem, it's only a symptom.

    I guess you have set a reference to a 11.0 object library in your workbook, means you are using early binding. The solution is to use late binding and use CreateObject for the external objects.

    Which reference did you set manually? Can you upload the workbook on a online filehoster, e.g. www.dropbox.com?

    Andreas.

    Dear Andreas,

    When I check my referencess, I have a 11.0 as set library, the poit is that i can not change it for 10.0 as it does not exist in my ref.

    How the code for late binding should look like and where I should put it?

    Thx for your support

    Was this answer helpful?

    0 comments No comments
  5. Andreas Killer 144.1K Reputation points Volunteer Moderator
    2012-01-07T19:52:57+00:00

    I checked and it seems that in the references he has 10.0 object library and I have 11.0

    What i can do to unify the coding so it is indifferent from Object Library version?

    Pls see coding below (in bold where it is currently buging)

    IMHO this is not the reason for your problem, it's only a symptom.

    I guess you have set a reference to a 11.0 object library in your workbook, means you are using early binding. The solution is to use late binding and use CreateObject for the external objects.

    Which reference did you set manually? Can you upload the workbook on a online filehoster, e.g. www.dropbox.com?

    Andreas.

    Was this answer helpful?

    0 comments No comments