ilfocorp
asked on
Automation Error Library Not Registered
Hello. I have Office 2010 and am trying to open an excel file in vba. I get the attached error. Can someone help me with resolving it.
Private Sub cmdOpen_Click()
Dim xlApp As Excel.Application
Set xlApp = CreateObject("Excel.Applic ation")
xlApp.Visible = True
ERROR:
Automation error
Library not registered
xlApp.Workbooks.Open "E:\DEVHELP\A\Abstract Reporting-Done\test\Templa te CoreAbsSum0915.xlsx", True, False
Debug.Print xlApp.Version
Set xlApp = Nothing
xlApp.Quit
End Sub
Automation-Error_LibraryNotRegistere.doc
Private Sub cmdOpen_Click()
Dim xlApp As Excel.Application
Set xlApp = CreateObject("Excel.Applic
xlApp.Visible = True
ERROR:
Automation error
Library not registered
xlApp.Workbooks.Open "E:\DEVHELP\A\Abstract Reporting-Done\test\Templa
Debug.Print xlApp.Version
Set xlApp = Nothing
xlApp.Quit
End Sub
Automation-Error_LibraryNotRegistere.doc
ASKER
Sorry guys. I put the error in the middle of my script. see updated question below;
Hello. I have Office 2010 and am trying to open an excel file in vba. I get the attached error. Can someone help me with resolving it.
Private Sub cmdOpen_Click()
Dim xlApp As Excel.Application
Set xlApp = CreateObject("Excel.Applic ation")
xlApp.Visible = True
xlApp.Workbooks.Open "E:\DEVHELP\A\Abstract Reporting-Done\test\Templa te CoreAbsSum0915.xlsx", True, False
Debug.Print xlApp.Version
Set xlApp = Nothing
xlApp.Quit
End Sub
ERROR:
Automation error
Library not registered
Hello. I have Office 2010 and am trying to open an excel file in vba. I get the attached error. Can someone help me with resolving it.
Private Sub cmdOpen_Click()
Dim xlApp As Excel.Application
Set xlApp = CreateObject("Excel.Applic
xlApp.Visible = True
xlApp.Workbooks.Open "E:\DEVHELP\A\Abstract Reporting-Done\test\Templa
Debug.Print xlApp.Version
Set xlApp = Nothing
xlApp.Quit
End Sub
ERROR:
Automation error
Library not registered
ASKER
Thanks Karrtik, but I am trying to open the excel file from Access 2010 vba.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ok,
In your code we are trying to use COM to open excel files. This error indicates that the COM interface we are trying create using create object is not found in the registry. This registry entries are created when the excel COM interop DLLs register themselves during installation, they can also be manually registered if we know the dll name. Try the solution that Wayne has suggested and get back to us if you still face some issues.
There is a good question on EE on the best way to do this in access using VBA, please see link below.
http://googleweblight.com/?lite_url=http://www.experts-exchange.com/questions/28380710/Opening-and-Closing-Excel-from-Access-in-VBA.html&ei=F3LQLF2E&lc=en-IN&s=1&m=497&ts=1449806112&sig=ALL1Aj739R3JnG_8z9yvjX0qIUVW78Nkkw
In your code we are trying to use COM to open excel files. This error indicates that the COM interface we are trying create using create object is not found in the registry. This registry entries are created when the excel COM interop DLLs register themselves during installation, they can also be manually registered if we know the dll name. Try the solution that Wayne has suggested and get back to us if you still face some issues.
There is a good question on EE on the best way to do this in access using VBA, please see link below.
http://googleweblight.com/?lite_url=http://www.experts-exchange.com/questions/28380710/Opening-and-Closing-Excel-from-Access-in-VBA.html&ei=F3LQLF2E&lc=en-IN&s=1&m=497&ts=1449806112&sig=ALL1Aj739R3JnG_8z9yvjX0qIUVW78Nkkw
You're also mixing your bindings :)
If you're going to use Late Binding, then do this:
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Applic ation")
Many people use Early Binding during development, so you can have Intellisense, but then switch over to Late Binding on deployment to avoid issues like you describe.
If you're going to use Late Binding, then do this:
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Applic
Many people use Early Binding during development, so you can have Intellisense, but then switch over to Late Binding on deployment to avoid issues like you describe.
ASKER
Excellent. Thank you.
Workbooks.Open ("sales.xls")
After work is done
Workbooks("sales.xls").Clo
http://www.excel-easy.com/vba/examples/close-open.html