Référence de la bibliothèque d'objects MS Office 14.0 dans le programme VB 6

Mon code de programme VB 6 fait reference à la bibliothèque d'objects 14.0, il est compilé et exécuté … fonctionnant bien avec le nouveau code (access à 14.0 bibliothèques).

Dans mon système de développement, Microsoft Office 2010 est installé (14.0 bibliothèque), où mon nouveau code est compilé et fonctionne correctement.

J'utilise ces bibliothèques pour convertir un document en pdf.

J'essaie d'installer la configuration du même programme VB 6 et d'exécuter dans une machine différente, où 14.0 bibliothèques ne sont pas présentes, car MS Office 2000 est installé sur cette machine (12.0 bibliothèques).

L'installation de l'installation réussit, mais le programme lance une erreur tout en référençant les bibliothèques 14.0.

Maintenant, j'ai besoin d'une aide à cet égard, que, Comment puis-je installer les bibliothèques d'object 14.0 sur la nouvelle machine, de sorte que les references seront là pour que le programme s'exécute.

Ou, sugérez-moi d'autres approches pour le faire …

Merci

Le problème est que vous utilisez la Reliure anticipée. Vous devez utiliser Late Liant.

Dans Early Binding, vous définissez une reference à la bibliothèque Excel Object xx.xx où, comme dans la Reliure tardive, vous ne le faites pas.

Voici un exemple des deux

Reliure anticipée

Sub EarlyBindingEx() Dim oXLApp As Excel.Application Dim oXLWb As Excel.Workbook Dim oXLWs As Excel.Worksheet '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = New Excel.Application End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub 

Reliure tardive

 Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub Sub LateBindingEx () Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub Dim oXLApp As Object Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub Dim oXLWb As Object, oXLWs comme object Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub '~~> Établir un object d'application EXCEL Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub Sur le résumé d'erreur Suivant Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub Définir oXLApp = GetObject (, "Excel.Application") Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub '~~> Si elle n'est pas trouvée, créez une nouvelle instance Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub Si Err.Number <> 0 Then Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub Définir oXLApp = CreateObject ("Excel.Application") Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub '~~> Afficher Excel Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub oXLApp.Visible = True Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub '~~> Ouvrir les files Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub Définissez oXLWb = oXLApp.Workbooks.Open ("C: \ Sample.xlsx") Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub '~~> Définir la feuille de travail pertinente Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub Définir oXLWs = oXLWb.Sheets (1) Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub ' Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub '~ ~> Reste de ton code Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub ' Sub LateBindingEx() Dim oXLApp As Object Dim oXLWb As Object, oXLWs As Object '~~> Establish an EXCEL application object On Error Resume Next Set oXLApp = GetObject(, "Excel.Application") '~~> If not found then create new instance If Err.Number <> 0 Then Set oXLApp = CreateObject("Excel.Application") End If Err.Clear On Error GoTo 0 '~~> Show Excel oXLApp.Visible = True '~~> Open files Set oXLWb = oXLApp.Workbooks.Open("C:\Sample.xlsx") '~~> Set the relevant worksheet Set oXLWs = oXLWb.Sheets(1) ' '~~> Rest of your code ' End Sub 

ICI est un lien MSDN concernant la binding anticipée contre la binding tardive.