Automation error library not registered vba

I developed an Access Application (Office 2003, 'simple' VBA, no .Net) and in an event handler I've:
  • Remove From My Forums
  • Question

  • I developed an Access Application (Office 2003, ‘simple’ VBA, no .Net) and in an event handler I’ve:

      Dim oXsl As Excel.Application
    
       ' ...
    
      Set oXsl = New Excel.Application

    and I read an excel file without any problem
    I HAVE read till yesterday: now, suddenly, I get the error on the line where I instance Excel

    The Excel reference is right, I haven’t modified nothing.
    The file mdb is in the same location as yeterday. I can’t understand, and, above all, I can’t imagine where to look for the cause. MSDN search gave me no applicable (or no understandable as applicable) results.

    I hope you can help me, because my work is blocked. Thanks in advance


    please, mark this as answer if it is THE answer
    —————-
    Diego Cattaruzza
    Microsoft MVP — Visual Basic: Development
    blog: http://community.visual-basic.it/Diego
    web site: http://www.visual-basic.it

Answers

  • I had this same problem (but with Excel 2007), and have now fixed it.  It is caused by having references to multiple versions of Excel in the registry, and automation defaulting to one that is no longer installed.

    In my case, I have Office 2007 installed, then upgraded to 2010, then uninstalled 2010 and re-installed Office 2007.  I still have OneNote 2010 installed (but that’s the only thing from Office 2010) — and probably because of this every now and again
    bits of Office 2010 reappear in the registry and corrupt the Office 2007 install.  Reinstalling Office 2007 does not fix it — perhaps uninstalling Office 2010 completely would, but it might not (and that’s not a possibility for me).

    The fix for the issue is hinted at here, for the same issue with Outlook:

    http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/9128583b-ddb6-4628-8085-1e6849f35c7f

    To fix it in Excel, what I did was do a search through the registry for registry data containing «Microsoft.Office.Interop.Excel» (since registry key in the above post relates to Outlook throwing the error rather than Excel).  Since I only have Excel
    2007 installed, then all references should be to Version 12.0.0.0 (2007) — I deleted the entire registry key for any entries that had references to Version 14.0.0.0 (2010), which is not installed.  As soon as I did this, my macro started working again.

    Incidentally, this issue also causes Adobe Acrobat 9 to fail (Explorer integration — i.e. right-click—>convert to Acrobat PDF — will no longer work).  

    • Marked as answer by

      Wednesday, August 29, 2012 6:20 AM

I have just tried everything but nothing work.

This is the start of my code:

 Public Sub Connect()

    Dim appProj As MSProject.Application
    Dim Resp As Variant

       Set appProj = CreateObject("Msproject.Application")
       Set Cronograma = appProj.ActiveProject

       With ThisWorkbook.Sheets("Project")
          If UCase(Trim(Cronograma.name)) = UCase(Trim(.Cells(4, 2))) Then
             Resp = MsgBox("Plan OK" & vbNewLine & "Starting line: " & Cronograma.Tasks.Count + 1 & vbNewLine _
                             & "Continue?", vbQuestion + vbYesNo + vbDefaultButton1, "Generator")
             If Resp = vbYes Then
                Status 1
                Call Main
             End If
          Else
             'Nothing
          End If
       End With

 End Sub

It’s enough to get it working properly with Excel 2013 and lower, but since I had to change to Excel 2016 (Office365) this error started to show every time I use project objects, in this case when I try to count tasks:

Run-time error ‘-2147319779 (8002801d)’:

Automation error Library not registered.

I’ve already tried everything that I found on the internet like registry cleaning of old Keys, unregistering and registering libraries, late binding the project object and much more.

Does anyone have yet discovered a solution for this?

If you encounter the  VBA Run-time error ‘Automation error Library not registered.’ then between your VBA project’s references there is a reference to a file that is “MISSING”.

This is the case when for example a DLL, OCX or another VBA project used while developing in your application is not installed on the computer the application is being used. Obviously, you should never distribute applications without making sure that the components used are available on the target computers, but there are cases in which VBA takes care of resolving the problem automatically, one example are the Microsoft Office applications, where each version installs in a separate folder containing a number (for instance for Office 2003 (Release 11) you have C:Program FilesMicrosoft OfficeOffice11)

In general, each reference is correctly mapped to the right -and probably also most recent- component, since the GUID of each application does not change. But there are cases where the component does not correctly remap (because the GUID has changed or because it is not available). If this occurs, then you will see such “MISSING” reference.

To correct the problem, open the VB-IDE, go to your project references (Tools -> References), either scroll the list and put or remove a checkmark in front of the desired component or browse for a file on your disk.

Ah, if you have access to the project, otherwise you’re out of luck.

Tip: before you distribute your application, run a compile (Debug -> Compile). If there is a missing reference, VBE may make this problem evident by issuing a compile error “Can’t find project or library” on a function that you know is correct (I had that on the String() function, not to confuse with VBA.String()). When you close the compiler error, VBE will open the references dialog for you.

When the ‘Automation error Library not registered.’ triggers on registered libraries

The funny thing is that a missing reference impacts on your code when addressing the other references in the project. Suppose you want to set a reference to “Visual Basic for Applications” then you would write the following statement (“VBA” is the codename for this reference):

Dim oReference As Object
Set oReference = ThisWorkbook.VBProject.References("VBA")

Using a named index with missing references triggers the error. However, if you use a numeric index to obtain a reference object, the error does not trigger.

Dim oReference As Object
Set oReference = ThisWorkbook.VBProject.References(1) ' Usually VBA is number 1

Even next code may trigger the error. Note the use of ‘may’ and not ‘will’. This is because the ‘.Name‘ property does not exist for missing references, so as long as the item’s counter is smaller than the missing reference item you are indeed able to query this property. The code stops running as soon as ‘lItem’ matches the index of the missing reference:

Dim oReference As Object, lItem As Long
For lItem = 1 To ThisWorkbook.VBProject.References.Count
    If (ThisWorkbook.VBProject.References(lItem).Name = "VBA") _
    Then Set oReference = ThisWorkbook.VBProject.References(lItem)
Next lItem

If you really want to play safe, use the ‘.Guid‘ property. This property does always exist, but is also means that you need to know it:

Dim oReference As Object, lItem As Long
For lItem = 1 To ThisWorkbook.VBProject.References.Count
    If (ThisWorkbook.VBProject.References(lItem).Guid = _
       "{000204EF-0000-0000-C000-000000000046}") _
    Then Set oReference = ThisWorkbook.VBProject.References(lItem)
Next lItem

Of course, you can always iterate through the references using For…Each, but remember to use the ‘.Guid‘ property:

Dim oReference As Object
For Each oReference In ThisWorkbook.VBProject.References
    If (oReference.Guid = "{000204EF-0000-0000-C000-000000000046}") _
    Then Exit For
Next lItem

The Guid is needed when you want to programmatically add references (the 0,0 at the end instructs VBA to load the most recent reference for this Guid):

Dim oReference As Object
For Each oReference In ThisWorkbook.VBProject.References
    If (oReference.Guid = "{000204EF-0000-0000-C000-000000000046}") _
    Then Exit For
Next lItem
If oReference Is Nothing _
Then Set oReference = ThisWorkbook.VBProject.References.AddFromGuid("{000204EF-0000-0000-C000-000000000046}", 0, 0)

You can get a list of the Guids used by your application by iterating the collection of references.

Dutch.

Содержание

  1. Access automation error библиотека не зарегистрирована
  2. Answered by:
  3. Question
  4. Answers
  5. Dutch Gemini’s Weblog Pages
  6. January 5, 2011
  7. VBA Run-time error ‘Automation error Library not registered.’
  8. When the ‘Automation error Library not registered.’ triggers on registered libraries
  9. Access automation error библиотека не зарегистрирована
  10. Вопрос
  11. Access automation error библиотека не зарегистрирована
  12. Вопрос
  13. Access automation error библиотека не зарегистрирована
  14. Вопрос

Access automation error библиотека не зарегистрирована

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

I developed an Access Application (Office 2003, ‘simple’ VBA, no .Net) and in an event handler I’ve:

and I read an excel file without any problem
I HAVE read till yesterday: now, suddenly, I get the error on the line where I instance Excel

The Excel reference is right, I haven’t modified nothing.
The file mdb is in the same location as yeterday. I can’t understand, and, above all, I can’t imagine where to look for the cause. MSDN search gave me no applicable (or no understandable as applicable) results.

I hope you can help me, because my work is blocked. Thanks in advance
please, mark this as answer if it is THE answer
—————-
Diego Cattaruzza
Microsoft MVP — Visual Basic: Development
blog: http://community.visual-basic.it/Diego
web site: http://www.visual-basic.it

Answers

I had this same problem (but with Excel 2007), and have now fixed it. It is caused by having references to multiple versions of Excel in the registry, and automation defaulting to one that is no longer installed.

In my case, I have Office 2007 installed, then upgraded to 2010, then uninstalled 2010 and re-installed Office 2007. I still have OneNote 2010 installed (but that’s the only thing from Office 2010) — and probably because of this every now and again bits of Office 2010 reappear in the registry and corrupt the Office 2007 install. Reinstalling Office 2007 does not fix it — perhaps uninstalling Office 2010 completely would, but it might not (and that’s not a possibility for me).

The fix for the issue is hinted at here, for the same issue with Outlook:

Источник

Dutch Gemini’s Weblog Pages

January 5, 2011

VBA Run-time error ‘Automation error Library not registered.’

If you encounter the VBA Run-time error ‘Automation error Library not registered.’ then between your VBA project’s references there is a reference to a file that is “MISSING”.

This is the case when for example a DLL, OCX or another VBA project used while developing in your application is not installed on the computer the application is being used. Obviously, you should never distribute applications without making sure that the components used are available on the target computers, but there are cases in which VBA takes care of resolving the problem automatically, one example are the Microsoft Office applications, where each version installs in a separate folder containing a number (for instance for Office 2003 (Release 11) you have C:Program FilesMicrosoft OfficeOffice11 )

In general, each reference is correctly mapped to the right -and probably also most recent- component, since the GUID of each application does not change. But there are cases where the component does not correctly remap (because the GUID has changed or because it is not available). If this occurs, then you will see such “MISSING” reference.

To correct the problem, open the VB-IDE, go to your project references (Tools -> References), either scroll the list and put or remove a checkmark in front of the desired component or browse for a file on your disk.

Ah, if you have access to the project, otherwise you’re out of luck.

Tip: before you distribute your application, run a compile (Debug -> Compile). If there is a missing reference, VBE may make this problem evident by issuing a compile error “Can’t find project or library” on a function that you know is correct (I had that on the String() function, not to confuse with VBA.String() ). When you close the compiler error, VBE will open the references dialog for you.

When the ‘Automation error Library not registered.’ triggers on registered libraries

The funny thing is that a missing reference impacts on your code when addressing the other references in the project. Suppose you want to set a reference to “Visual Basic for Applications” then you would write the following statement (“VBA” is the codename for this reference):

Dim oReference As Object
Set oReference = ThisWorkbook.VBProject.References(«VBA»)

Using a named index with missing references triggers the error. However, if you use a numeric index to obtain a reference object, the error does not trigger.

Dim oReference As Object
Set oReference = ThisWorkbook.VBProject.References(1) ‘ Usually VBA is number 1

Even next code may trigger the error. Note the use of ‘may’ and not ‘will’. This is because the ‘.Name‘ property does not exist for missing references, so as long as the item’s counter is smaller than the missing reference item you are indeed able to query this property. The code stops running as soon as ‘ lItem ’ matches the index of the missing reference:

Dim oReference As Object, lItem As Long
For lItem = 1 To ThisWorkbook.VBProject.References.Count
If (ThisWorkbook.VBProject.References(lItem).Name = «VBA») _
Then Set oReference = ThisWorkbook.VBProject.References(lItem)
Next lItem

If you really want to play safe, use the ‘.Guid‘ property. This property does always exist, but is also means that you need to know it:

Dim oReference As Object, lItem As Long
For lItem = 1 To ThisWorkbook.VBProject.References.Count
If (ThisWorkbook.VBProject.References(lItem).Guid = _
«<000204ef-0000-0000-c000-000000000046>«) _
Then Set oReference = ThisWorkbook.VBProject.References(lItem)
Next lItem

Of course, you can always iterate through the references using For…Each, but remember to use the ‘.Guid‘ property:

Dim oReference As Object
For Each oReference In ThisWorkbook.VBProject.References
If (oReference.Guid = «<000204ef-0000-0000-c000-000000000046>«) _
Then Exit For
Next lItem

The Guid is needed when you want to programmatically add references (the 0,0 at the end instructs VBA to load the most recent reference for this Guid):

Dim oReference As Object
For Each oReference In ThisWorkbook.VBProject.References
If (oReference.Guid = «<000204ef-0000-0000-c000-000000000046>«) _
Then Exit For
Next lItem
If oReference Is Nothing _
Then Set oReference = ThisWorkbook.VBProject.References.AddFromGuid(«<000204ef-0000-0000-c000-000000000046>«, 0, 0)

You can get a list of the Guids used by your application by iterating the collection of references.

Источник

Access automation error библиотека не зарегистрирована

Вопрос

I created an input request form database using Access 2003 which automatically creates an email using VBA to create the email. This program works fine on all computers using Windows XP but we recently purchased a computer with Windows 7 and on that computer the runtime error Automation error — library not registered occurs. I believe the problem is a DLL file that is missing but have no idea which DLL file. Does anyone have any suggestions on how to fix this problem? I have included the code and where the error occurs for reference:

Private Sub cmdSubmitRequest()

Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olfolder As Outlook.MAPIFolder
Dim olMailItem As Outlook.MailItem

Dim varBodyText As Variant
Dim strName As String
Dim strDepartment As String
Dim strChargeNumber As String

Dim strRequiredDate As String
Dim strRequestDate As String
Dim strAddtionalInfo As String

Dim strWorkLocation As String
Dim strProductType As String

strName = «Last Name: »
strDepartment = «Department: »
strChargeNumber = «Charge Number: »
strRequiredDate = «Date Wanted: »
strRequestDate = «Date Written: »
strWorkLocation = «Location: »
strProductType = «Product Type: »
strAdditionalInfo = «Description of Work: «

Set olApp = CreateObject(«Outlook.Application») Runtime Error Occurs At This Line of Code

Set olNS = olApp.GetNamespace(«MAPI»)
Set olfolder = olNS.GetDefaultFolder(olFolderInbox)
Set olMailItem = olfolder.Items.Add(«IPM.Note»)

This is only partial code. I did not want to bore you with details.

The Windows 7 machine has Office 2003 Professional installed and all Oulook functions appear to work. I appreciate any help you can give me. We will be in a transition period for some time running both Windows XP and Windows 7 so this will be an ongoing problem. Thank you for your help.

Источник

Access automation error библиотека не зарегистрирована

Вопрос

I created an input request form database using Access 2003 which automatically creates an email using VBA to create the email. This program works fine on all computers using Windows XP but we recently purchased a computer with Windows 7 and on that computer the runtime error Automation error — library not registered occurs. I believe the problem is a DLL file that is missing but have no idea which DLL file. Does anyone have any suggestions on how to fix this problem? I have included the code and where the error occurs for reference:

Private Sub cmdSubmitRequest()

Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olfolder As Outlook.MAPIFolder
Dim olMailItem As Outlook.MailItem

Dim varBodyText As Variant
Dim strName As String
Dim strDepartment As String
Dim strChargeNumber As String

Dim strRequiredDate As String
Dim strRequestDate As String
Dim strAddtionalInfo As String

Dim strWorkLocation As String
Dim strProductType As String

strName = «Last Name: »
strDepartment = «Department: »
strChargeNumber = «Charge Number: »
strRequiredDate = «Date Wanted: »
strRequestDate = «Date Written: »
strWorkLocation = «Location: »
strProductType = «Product Type: »
strAdditionalInfo = «Description of Work: «

Set olApp = CreateObject(«Outlook.Application») Runtime Error Occurs At This Line of Code

Set olNS = olApp.GetNamespace(«MAPI»)
Set olfolder = olNS.GetDefaultFolder(olFolderInbox)
Set olMailItem = olfolder.Items.Add(«IPM.Note»)

This is only partial code. I did not want to bore you with details.

The Windows 7 machine has Office 2003 Professional installed and all Oulook functions appear to work. I appreciate any help you can give me. We will be in a transition period for some time running both Windows XP and Windows 7 so this will be an ongoing problem. Thank you for your help.

Источник

Access automation error библиотека не зарегистрирована

Вопрос

I created an input request form database using Access 2003 which automatically creates an email using VBA to create the email. This program works fine on all computers using Windows XP but we recently purchased a computer with Windows 7 and on that computer the runtime error Automation error — library not registered occurs. I believe the problem is a DLL file that is missing but have no idea which DLL file. Does anyone have any suggestions on how to fix this problem? I have included the code and where the error occurs for reference:

Private Sub cmdSubmitRequest()

Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olfolder As Outlook.MAPIFolder
Dim olMailItem As Outlook.MailItem

Dim varBodyText As Variant
Dim strName As String
Dim strDepartment As String
Dim strChargeNumber As String

Dim strRequiredDate As String
Dim strRequestDate As String
Dim strAddtionalInfo As String

Dim strWorkLocation As String
Dim strProductType As String

strName = «Last Name: »
strDepartment = «Department: »
strChargeNumber = «Charge Number: »
strRequiredDate = «Date Wanted: »
strRequestDate = «Date Written: »
strWorkLocation = «Location: »
strProductType = «Product Type: »
strAdditionalInfo = «Description of Work: «

Set olApp = CreateObject(«Outlook.Application») Runtime Error Occurs At This Line of Code

Set olNS = olApp.GetNamespace(«MAPI»)
Set olfolder = olNS.GetDefaultFolder(olFolderInbox)
Set olMailItem = olfolder.Items.Add(«IPM.Note»)

This is only partial code. I did not want to bore you with details.

The Windows 7 machine has Office 2003 Professional installed and all Oulook functions appear to work. I appreciate any help you can give me. We will be in a transition period for some time running both Windows XP and Windows 7 so this will be an ongoing problem. Thank you for your help.

Источник

  • Remove From My Forums
  • Question

  • I created an input request form database using Access 2003 which automatically creates an email using VBA to create the email.  This program works fine on all computers using Windows XP but we recently purchased a computer with Windows 7 and on that
    computer the runtime error Automation error — library not registered occurs.  I believe the problem is a DLL file that is missing but have no idea which DLL file.  Does anyone have any suggestions on how to fix this problem? I have included the code
    and where the error occurs for reference:

     Private Sub cmdSubmitRequest()

    Dim olApp As Outlook.Application
    Dim olNS As Outlook.NameSpace
    Dim olfolder As Outlook.MAPIFolder
    Dim olMailItem As Outlook.MailItem

    Dim varBodyText As Variant
    Dim strName As String
    Dim strDepartment As String
    Dim strChargeNumber As String

    Dim strRequiredDate As String
    Dim strRequestDate As String
    Dim strAddtionalInfo As String

    Dim strWorkLocation As String
    Dim strProductType As String

    strName = «Last Name: «
    strDepartment = «Department: «
    strChargeNumber = «Charge Number: «
    strRequiredDate = «Date Wanted: «
    strRequestDate = «Date Written: «
    strWorkLocation = «Location: «
    strProductType = «Product Type: «
    strAdditionalInfo = «Description of Work: «

    Set olApp = CreateObject(«Outlook.Application»)
    Runtime Error Occurs At This Line of Code

    Set olNS = olApp.GetNamespace(«MAPI»)
    Set olfolder = olNS.GetDefaultFolder(olFolderInbox)
    Set olMailItem = olfolder.Items.Add(«IPM.Note»)

    This is only partial code.  I did not want to bore you with details.

    The Windows 7 machine has Office 2003 Professional installed and all Oulook functions appear to work.  I appreciate any help you can give me.  We will be in a transition period for some time running both Windows XP and Windows 7 so this will be
    an ongoing problem.  Thank you for your help.

    Click to be alerted when this question is answered. The more clicks, the faster the question is answered.1
    person needs an answer

Answers

  • Sounds like a Microsoft Office/VBA question, not a Windows OS scripting question. I would try asking in a more appropriate forum.

    HTH,

    Bill

    • Marked as answer by

      Friday, June 18, 2010 3:51 AM

Dear Friends,

I had installed Office 2007 in my system. After that I installed the trial version of Office 2013 in my system. There are so many new features in this version. Really great one. You can also try installing the trial version of Office 2013 in your system by clicking on the below image:

Try Office - 2013 - Trial Version

Try Office — 2013 — Trial Version

This article is to share with you one issue which i faced with this. Once I uninstalled 2013 then in Excel Macro, wherever I was using Excel.Application Library, It started throwing the below error:

 
Automation error. Library not registered

How To fix this:

You need to delete the below Registry Key from the Local Machine. Follow the below step to fix this issue:

Step 1. Go to Run Prompt and Type “regedit” and click ok
Step 2. Expand HKEY_LOCAL_MACHINE
Step 3. Expand Classes
Step 4. Expand TypLib
Step 5. Expand 00020813-0000-0000-C000-000000000046
Step 6. Select 1.8
Step 7. Right Click on 1.8 and Delete this.

Here you are done.

Buy a coffee for the author

bonanza

2 / 2 / 0

Регистрация: 23.03.2015

Сообщений: 75

1

20.03.2019, 07:20. Показов 4784. Ответов 9

Метки нет (Все метки)


Добрый день.
Возникла задача формировать таблицу excel из макроса outlook.
Оба приложения установлены одновременно из одного дистрибутива msOffice 2010, установлен sp1.
Без подключения объектной библиотеки excel (tools > references, microsoft excel 14.0 object library) не работает раннее связывание и среда ругается на такие сложные вещи, как range. Cells при этом понимает ).
Если подключить библиотеку — возникает ошибка «Automation error. Library not registered».

Ошибка возникает, например на 2 строе этого кода:

Visual Basic
1
2
dim xlApp as excel.application
set xlApp = CreateObject("excel.application")

Как это лечить?

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



snipe

4037 / 1422 / 394

Регистрация: 07.08.2013

Сообщений: 3,539

20.03.2019, 08:24

2

Visual Basic
1
dim xlApp as object

так раннее связывание и предполагает что библиотека уже подключена (принудительно руками)
а вот позднее связывание не предполагает что библиотека подключена
что лучше — тут много про это уже сказано
по мне так …
в процессе разработки кода подключить библиотеку
а при передаче в эксплуатацию переделать код на позднее связывание

Добавлено через 9 минут
и аккуратнее с префиксом xl в переменных
Excel этот префикс использует для обозначения своих констант



1



2 / 2 / 0

Регистрация: 23.03.2015

Сообщений: 75

20.03.2019, 09:15

 [ТС]

3

snipe, подскажите, как в тексте макроса outlook подключить библиотеку экселя!
Поставить галочку в referenses, походу, на моем компе недостаточно (win10 + office 2010). Хотя у коллеги с win7 ошибка пропадает.
PS про префикс спасибо, учту!



0



4037 / 1422 / 394

Регистрация: 07.08.2013

Сообщений: 3,539

20.03.2019, 10:08

4

может все таки excel криво стоит



0



bonanza

2 / 2 / 0

Регистрация: 23.03.2015

Сообщений: 75

20.03.2019, 12:27

 [ТС]

5

snipe, тоже об этом подумал. Изначально было win10_x64 + office 2010_x86.
переустановил этот же офис — не помогло, поставил office 2010_x64 — не помогло. Установка sp2 в обоих случаях так же не повлияла. Другие версии офиса ставить не могу.
Скрипт валится в ошибку «библиотека не зарегистрирована».
может есть возможность как-то ее перегистриировать?

зы. как альтернатива — можно попробовать отключить либу и полностью объявлять все методы… но там тоже для меня есть непонятки.

Visual Basic
1
2
3
Set xlApp = CreateObject("Excel.Application")
Set xlWbRep = xlApp.Workbooks.Open("d:monitoring.xlsx")
xlApp.xlWbRep.worksheets("Лист1").range(cells(3, iFCol), cells(45, iFCol + 5)).Clear

в этом коде среда не понимает слово cells.
Как это написать корректно?



0



pashulka

4129 / 2233 / 940

Регистрация: 01.12.2010

Сообщений: 4,624

20.03.2019, 12:33

6

Цитата
Сообщение от bonanza
Посмотреть сообщение

в этом коде среда не понимает слово cells.

Нужно просто явно указать родителя, т.е.

Visual Basic
1
2
3
4
5
Set xlApp = CreateObject("Excel.Application")
Set xlWbRep = xlApp.Workbooks.Open("d:monitoring.xlsx")
With xlApp.xlWbRep.Worksheets("Лист1")
     .Range(.Cells(3, iFCol), .Cells(45, iFCol + 5)).Clear
End With



1



2 / 2 / 0

Регистрация: 23.03.2015

Сообщений: 75

20.03.2019, 12:48

 [ТС]

7

это я уже пробовал.
на строке With xlApp.xlWbRep.Worksheets(«Лист1») скрипт падает с ошибкой «object doesnt support this property or method»



0



pashulka

4129 / 2233 / 940

Регистрация: 01.12.2010

Сообщений: 4,624

20.03.2019, 13:03

8

Лучший ответ Сообщение было отмечено bonanza как решение

Решение

Сорри, за копирование Ваших ошибок

Visual Basic
1
With xlWbRep.Worksheets("Лист1")

или

Visual Basic
1
With xlApp.Workbooks("Monitoring.xlsx").Worksheets("Лист1")



1



2 / 2 / 0

Регистрация: 23.03.2015

Сообщений: 75

20.03.2019, 16:07

 [ТС]

9

pashulka, спасибо, завтра попробую.
Похоже беда с либой связана с доменными политиками, а значит в нашем случае неизлечима )
А можете объяснить теоретическую разницу между моей кривой конструкцией и предложенными Вами вариантами? Ну так, для моего общего развития ))



0



I stumbled across the answer, so I’m posting it here in case anyone else has a similar problem. In my case I had references under the Excel key (1.7 and 1.9).
I backed up the PC, exported the Registry Key, then deleted the 1.9 key.
Word 2010 now opens Excel 2010 spreadsheets beautifully. Thanks Palisade!

THIS ARTICLE IS BASED ON AN ARTICLE FROM PALISADE SOFTWARE

Removing Outdated References to Office from the System Registry
Removing a version of Microsoft Office can sometimes leave behind «orphan» keys in the System Registry. These references to products which are no longer installed can prevent add-ins from working correctly with Excel, You may see messages such as «Application-defined or object-defined error», «Automation error: Library not registered», «Error in loading DLL», «Could not contact the Microsoft Excel application», «File name or class name not found during Automation operation», or «Object variable or with block variable not set
To remove the outdated references, you will need to edit the System Registry, as detailed below
1. Click Start � Run, type REGEDIT and click OK.
2. Click on Computer at the top of the left-hand panel, then press Ctrl+F to bring up the search window.
Paste the following string including the curly braces {…}, into the search window:
(this is the Key for Excel)
{00020813-0000-0000-C000-000000000046}
3. Check (tick) the Keys box and Match whole string only; clear Values and Data.
4. Click the + sign at the left of {00020813-0000-0000-C000-000000000046} to expand it. You will see one or more subkeys:
1.5 for Excel 2003.
1.6 for Excel 2007.
1.7 for Excel 2010.
1.8 for Excel 2013.
1.9 for Excel 2016.
Identify the one(s) that do not match the version(s) of Excel you actually have installed. If all of them do match installed Excel versions, omit steps 5 and 6.
5. You are about to delete the key(s) that correspond to versions of Microsoft Excel that you do not have. For safety’s sake, you may want to back them up first. Right-click on {00020813-0000-0000-C000-000000000046}, select Export, and save the file where you’ll be able to find it.
6. Right-click the �1.x� key that does not belong, select Delete, and confirm the deletion. Repeat for each 1.something key that does not belong.
7. The {00020813-0000-0000-C000-000000000046} key can occur in more places. Usually they all have the same subkeys, but not always, so you need to examine each instance. Tap the F3 key to get to each of the others in turn. For each one, repeat steps 4 through 6 (click the + sign, export the key to a new file, and delete the orphaned 1.something entries).

Next, repeat the above process using the Key for Office, which is:-
{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}

The subkeys for Office are
2.3 for Office 2003.
2.4 for Office 2007.
2.5 for Office 2010.
2.6 and 2.7 for Office 2013.
(2.6 and 2.7 are okay for Office 2016 as well, if there is a reference to Office16 under 2.7.)
2.8 for Office 2016.

Your software should now run as normal.

Written by Allen Wyatt (last updated March 23, 2021)
This tip applies to Excel 97, 2000, 2002, and 2003


When you start Excel, it goes through quite a few procedures to make sure that everything is running properly. If it detects an error, you may see an error message in a dialog box. Sometimes the messages you see in the dialog box are not that clear, and a few are downright cryptic.

For instance, you may see a message that says «object library not registered,» and be completely lost as to what it means. In this case, it is helpful to understand how Excel works with external programs.

During part of the startup process, Excel may load any number of add-ins that provide additional functionality to your copy of Excel. Basically, these add-ins are collections of macros that perform certain tasks. Macros, in turn, can rely upon other files that contain information that helps them perform their duties. These external files are called libraries.

Excel comes with an amazing number of libraries, but not all of them are accessible at the same time. A library is only available after it has been «registered» with Excel. If the library is not registered, then Excel cannot use it and the macros in the add-in cannot use it. The result: an error message.

The best way to troubleshoot this problem is for you to determine what add-ins are being loaded when you start Excel. Examine your Excel Startup folder, and make sure you know what they are all doing. (You don’t need to know what they are doing, step by step, but you should be familiar with what the add-in does, in general.)

Next, find another system that loads the same add-ins. (This should be easy to do if you work in an office, but more difficult if you are a home user.) Once you find the similar system, make sure it starts up without problem. If it does, then on the problem-free system, do the following:

  1. Press Alt+F11 to display the VBA Editor.
  2. Choose References from the Tools menu. You see the References dialog box. (See Figure 1.)
  3. Figure 1. The References dialog box.

  4. Make note (on a piece of paper) of the names of the libraries that have check marks next to them. Write the exact names, as there could be many libraries with similar names. Also, all the selected libraries—those with check marks—should be listed at the top of the reference list.
  5. Close the References dialog box.
  6. Close the VBA Editor.

Now, on the system that has problems, do these same steps, except in Step 3 you need to make sure that the same libraries are selected as those you wrote down. When you close the VBA Editor, restart Excel to see if the problem is still there. If it is, or if you couldn’t find one of the noted libraries on the problem system, then you may need to re-register Excel completely. If so, follow these steps:

  1. Make sure that Excel is not running (exit the program).
  2. Click the Start button to displays the Start menu.
  3. From the Start menu, choose Run. Windows displays the Run dialog box. (See Figure 2.)
  4. Figure 2. The Run dialog box.

  5. In the Open box, enter the full path name to your Excel program, followed by the /regserver switch. If the full path name includes spaces, surround the full path name by quote marks. The following is an example of what you can enter in the Open box (your path may be different):
  6.      "c:Program FilesMicrosoft OfficeOfficeExcel.exe" /regserver
    
  7. Click OK.

When you restart Excel, the problem should have disappeared. If it didn’t, then you need to figure out exactly which add-in is causing the problem. You do this by locating the add-in files in the Startup folder, and renaming them or moving them to a temporary folder. Do this one file at a time, restarting Excel after each renaming or move. When the problem disappears, you know you found the problem add-in, and you can contact the vendor to find out how to resolve the problem.

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I’ve prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training.
This tip (2952) applies to Microsoft Excel 97, 2000, 2002, and 2003.

Author Bio

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. Learn more about Allen…

MORE FROM ALLEN

Repeating Your Typing

Want a quick way to repeat a word or phrase you just typed? Here’s the shortcut you need.

Discover More

Formatting Fractions

Need to have a great looking fraction in a document? It’s relatively easy to do if you apply the formatting techniques …

Discover More

Easily Copying Cell Formatting

Copying table cell formatting from one place to another can be a tedious process as Word doesn’t provide a way to do the …

Discover More

Понравилась статья? Поделить с друзьями:
  • Automation error 2147417848
  • Automatic registration failed at join phase exit code unknown hresult error code 0x801c001d
  • Automake error no makefile am found for any configure output
  • Automake error configure ac is required
  • B0022 0d шевроле каптива ошибка