Microsoft office object library где находится
i am also using Office 365.
You can go to Visual Studio.
Open your project.
Right click on References and click Add Reference.
you will find 15.0 version of Access interop. which you can try to reference and check whether it solve your issue or not.
if your issue is persist then let us know which version of Visual Studio you are using.
what kind of project you are developing and if possible then you can try to post sample code to reproduce the issue.
Thanks, using .NET, it throws a "Cannot create ActiveX component" error on this line: applicationObject = CreateObject ( "Access.Application" )
Thanks, using VS 2015, I do not see this reference. Neither under Assemblies, nor under COM. Is it possible to get the needed driver separately somehow, or to get it "reinstated"?
It is better , if you post a sample code that generates an error.
We will try to make a test with it.
Also try to provide detailed information about your project type , VS version etc.
Did you try to check the Access References as i mentioned in my previous post?
Generally Office PIA get installed when you install the Office.
So it should be available in references.
Let us know about your testing result.
So that we will try to provide further suggestions , if needed.
I think we posted our replies at the same time :-)
So additional answers:
Dim oAccess As Access.Application
Dim x As Long
AccessExecutablePath = New FileInfo("C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE").FullName
x = Shell(AccessExecutablePath & " " & Chr(34) & DatabasePath & Chr(34) & " /runtime", AppWinStyle.MinimizedNoFocus)
oAccess = New Access.Application
oAccess = GetObject(DatabasePath)
oAccess.PrintReport("Some_Report_Saved_In_MSACCESS")
- I have used this code in several windows applications, both x86 and x64 compiled.
- The reference should be available, but it isn't. Can I get it separately, or can we fix this issue somehow?
What is the project type did you use?
Can you open Access application to create a simple database manually?
For this new database, turn to VBA Editor window-> Tools->Reference-> Is there Microsoft Access 16.0 Object library in it?
In the Access application / database, I can see the Microsoft Access 16.0 Object library, and also all the other Office libraries like Excel 16.0, Outlook 16.0 etc.
So apparently they did get installed. How do I get them to show up in Visual Studio?
- Open Visual Studio Community 2015
version 14.0.25431.01 - New Project
- Templates > Visual Basic > Windows > Windows Forms Application
- Add button to form
- Open Project properties > References
- Add
- Look for Microsoft.Office.Interop.Access (any version)
- Reference is not in the list
- Look for Microsoft Access xx.x Object library
- Reference is not in the list
- No need to proceed further
- Open Visual Studio Community 2015
version 14.0.25431.01 - New Project
- Templates > Visual Basic > Windows > Windows Forms Application
- Add button to form
- Open Project properties > References
- Add
- Look for Microsoft.Office.Interop.Access (any version)
- Reference is not in the list
- Look for Microsoft Access xx.x Object library
- Reference is not in the list
- No need to proceed further
The Microsoft Access x.x library should be visible in the list when the Add Reference COM tab is selected. If it is not visible, then it sounds like you have an installation issue with Office.
The Office PIA is installed through the Visual Studio installation configuration. I believe it's the Office/SharePoint Development option.
Paul ~~~~ Microsoft MVP (Visual Basic)
You were right, all it took was an online repair of Office, and the referenced showed up in Visual Studio.
I am actually trying to do something similar, but the issue is I can not have Office installed on the server so I somehow need to use the object library and run an Excel Macro.
I used ace.12 and I am able to get the excel file and also get its sheet name with the code below:
But I cannot make the Access.Application work at all. Is there any thing I can download and add as a refrence and make it work without installing Office??
Public Sub Main()
Dim fileToTest As String
Dim tableToTest As String
Dim connectionString As String
Dim excelConnection As OleDbConnection
Dim excelTables As DataTable
Dim excelTable As DataRow
Dim currentTable As String
fileToTest = Dts.Variables("ExcelFile").Value.ToString
tableToTest = Dts.Variables("ExcelTable").Value.ToString
Dts.Variables("ExcelTableExists").Value = False
If File.Exists(fileToTest) Then
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" &
"Data Source=" & fileToTest &
";Extended Properties=Excel 8.0"
excelConnection = New OleDbConnection(connectionString)
excelConnection.Open()
excelTables = excelConnection.GetSchema("Tables")
For Each excelTable In excelTables.Rows
currentTable = excelTable.Item("TABLE_NAME").ToString
MessageBox.Show(currentTable)
If currentTable = tableToTest Then
Dts.Variables("ExcelTableExists").Value = True
End If
Next
End If
Dts.TaskResult = ScriptResults.Success
' Dts.TaskResult = ScriptResults.Success
End Sub
I think your issue is not similar.
In the original post user was using MS Office on local.
You are working without office on server side and want to use Excel and Access Object library.
It is not recommended to use Office interop on server side.
Generally, We suggest developers to use Open XML as an alternative.
So you can also try to check it, Whether it helps you to solve your issue.
If then also you have any further question then I suggest you to create a new thread with detailed information about your issue.
We will try to provide further suggestions to solve the issue.
Note sure why you need "fileInfo" class, but it don't matter.
However, you path name looks wrong. the x32 bit version of Access on a x64 bit machine will be:
"C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE"
So it not clear how your previous code worked, but "most" machines today are x64 bits, and the vast majority of office installs are x32. You thus have to use the
"C:\Program Files (x86)
as a path name to get to the msaccess.exe file.
I have seen a number of "wonkey" setups where the IT folks did not know better and they forced the x32 install into the x64 bit folder (Program Files). Windows does not FORCE this install location, but is only a general accepted location that "most installers respect. (in other words, you can install x32 programs into what is supposed to be reserved for x64 (c:\Program files).
And, it turns out you can also install x64 bit programs into what is supposed to be reserved for x32 (program Files (x86).
So while I seen some IT folks install always and everything into the x64 bit program file, including a mix of x32, and x64 programs (which is allowed), it likely that Access is x32, and it likely that it is installed in c:Program Files (x86).
Using the example provided in codeproject I am struggling to work out where I can find the reference to the library Microsoft.Office.Core.
I am getting the error "The referenced component 'Microsoft.Office.Core' could not be found."
I only have office 2007 enterprise edition and outlook 2003 installed on this system. Could this be the cause of this? Otherwise which specific dll am I supposed to be referencing?
Tried both suggestions and still seem to be stuck. The question is what is the "COM Library appropriate for your system" in my case?
13 Answers 13
You can add reference of Microsoft.Office.Core from COM components tab in the add reference window by adding reference of Microsoft Office 12.0 Object Library . The screen shot will shows what component you need.
I used "Microsoft Office 14.0 Object Library" (12.0 didn't exist) and it worked as well. Also, I had to delete the reference to "Microsoft.Office.Core" first.
I am using Visual Studio 2017 but I cannot see the the "Microsoft Office XX.X Object Library" in the COM tab. Do I need to install "Microsoft Office"?
@Kin Did you find out what to do? I'm also using VS 2017 and I don't see a reference to the office's libraries. Did you have to install Microsoft Office?
None of the above answer helped me, i was using Visual Studio 2017. What I did is, installed Office/SharePoint Development using Visual Studio Installer.
After that, I was able to see 'office', this assembly contains Microsoft.Office.Core.
Hope this helps you.
You need to download and install the PIA (primary interop assemblies) for the version of Office you are using. Once installed you can then add a reference to your project and they will be available from the add reference dialog. Here are the links to download them.
Installed PIA but couldn't find them in "Add reference", but then it worked for me by adding the DLL from path directly e.g. C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\xxxx\.
-
Download and install: Microsoft Office Developer Tools
Add references from:
After installing the Office PIA (primary interop assemblies), add a reference to your project -> its on the .NET tab - component name "Office"
Now there is a nuget package for that.
First I didn't find office in COM, so tried this nuget and it worked!
Adding to answer: If you install an Office Interop lib through the NuGet package manager console (say PowerPoint or Excel), it looks to install this, too. the same does not seem to be true if you use the Visual Studio NuGet GUI
You can use this NuGet package which includes the interop assemblies in addition to the office assembly.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
If your system does not have Microsoft Office Outlook 2003 you may have to change the References used by the "OutlookConnector" project. That is to say, if you received a build error described as "The type of namespace name 'Outlook' could not be found", you probably don't have Office 2003. Simply expand the project references, remove the afflicted items, and add the COM Library appropriate for your system. If someone has a dynamic way to handle this, I'd be curious to see you've done.
In my Excel 2016 project (Windows 7), I'd like to work with the clipboard:
But I've got this compiler Error at the first line of code:
So I would like to add the reference to the Microsoft Forms 2.0 Object Library but I have no FM20.DLL file on my entire computer (I have searched through explore and find with cygwin).
I expect to see it as in the screenshot below, but I can't find it.
How can I make it appear?
You don't need Forms 2.0 to work with the Windows clipboard - use the Win32 API instead, see this thread on MSDN
And have you tried to re-install Excel? When re-installing take care about the tools for Office and VBA.
6 Answers 6
On 64-bit machines, FM20.dll is in the C:\Windows\sysWOW64 directory. It's 32 bit.
Not only it is the correct answer, but does help explain this strange behaviour that I noticed and asked why.
I have Office 64-bit and FM20.dll is not in the sysWOW64 folder, but is in the C:\Windows\System32 folder (strangely, only when browsing from the "References - VBAProject box, but is not visible in Windows Explorer even with all files showing including hidden/protected system files). I'm not sure if it will work correctly with Excel 64-bit, but so far so good.
I found FM20.DLL in C:\Program Files (x86)\Microsoft Office\root\VFS\SystemX86; that's with MS Office 2016 and Windows 10.
Maybe you can try a late binding using the CLSID
Dim MyDataObj As Object Set MyDataObj = CreateObject("New:")
or something like that.
From this old knowledge base article my guess would be this DLL is perhaps only included in older versions of Office? This part seemed promising:
However, as the linked tool is from 1997, you'll need to run its setup in "compatibility mode" by right-clicking on the executable and selecting "Properties" then clicking on the "Compatibility" tab and selecting "Windows 95" in the "Run this program in compatibility mode for:" dropdown. Then run it as administrator (this worked for me using Windows 8.1).
Answered by:
Question
but i cant find this Microsoft Excel 11.0 Object Library in Add Reference ---> com tab
where can i find this.
plz help me out
Answers
Do you have Microsoft Office Excel installed on your machine? Depending on the version it may be Microsoft Excel 10.0, 11.0, 12.0, etc. My understanding is that Microsoft Office Excel needs to be installed in order for this reference to be available, but I may be wrong. I can see it on my machine under the COM tab.
Others on the forum might be more knowledgeable in this than I, but I figured I'd take a stab at some of the more obvious possible issues. Please post back if you can't find it, etc.
To obtain the reference to interop with excel in your program, you have to install the PIA of the excel (first install the excel).
If you have installed Office 2003, just follow the steps to add the reference:
All replies
Do you have Microsoft Office Excel installed on your machine? Depending on the version it may be Microsoft Excel 10.0, 11.0, 12.0, etc. My understanding is that Microsoft Office Excel needs to be installed in order for this reference to be available, but I may be wrong. I can see it on my machine under the COM tab.
Others on the forum might be more knowledgeable in this than I, but I figured I'd take a stab at some of the more obvious possible issues. Please post back if you can't find it, etc.
Thanks for your information.
To obtain the reference to interop with excel in your program, you have to install the PIA of the excel (first install the excel).
If you have installed Office 2003, just follow the steps to add the reference:
I'm totally new to doing Outlook Add Ins and am having the time of my life getting the basic configuration correct.
I'm on Windows XP Professional, Office 2003 Basic and trying to get the code to work that duplicates how and why an Office exe file will not quit, etc.
I can't find the Microsoft Excel 11.0 Object Library I can only find the Microsoft Office 11 Object Library.
I do have the PIAs installed but I'll bet 100 bucks against a rusty nail I'm being bit by not having plain old Microsoft Office 2003 as opposed to Microsoft Office Basic Edition 2003.
Are you familiar enough with the versions to know if the PIAs won't interact with this edition of office? I can send screen shots of what I'm running into as it's a simple thing, I'm sure.
I'm thinking just remove/reinstall the Office Version and the PIAs. Overkill, but maybe that will handle it.
i am also using Office 365.
You can go to Visual Studio.
Open your project.
Right click on References and click Add Reference.
you will find 15.0 version of Access interop. which you can try to reference and check whether it solve your issue or not.
if your issue is persist then let us know which version of Visual Studio you are using.
what kind of project you are developing and if possible then you can try to post sample code to reproduce the issue.
Thanks, using .NET, it throws a "Cannot create ActiveX component" error on this line: applicationObject = CreateObject ( "Access.Application" )
Thanks, using VS 2015, I do not see this reference. Neither under Assemblies, nor under COM. Is it possible to get the needed driver separately somehow, or to get it "reinstated"?
It is better , if you post a sample code that generates an error.
We will try to make a test with it.
Also try to provide detailed information about your project type , VS version etc.
Did you try to check the Access References as i mentioned in my previous post?
Generally Office PIA get installed when you install the Office.
So it should be available in references.
Let us know about your testing result.
So that we will try to provide further suggestions , if needed.
I think we posted our replies at the same time :-)
So additional answers:
Dim oAccess As Access.Application
Dim x As Long
AccessExecutablePath = New FileInfo("C:\Program Files\Microsoft Office\root\Office16\MSACCESS.EXE").FullName
x = Shell(AccessExecutablePath & " " & Chr(34) & DatabasePath & Chr(34) & " /runtime", AppWinStyle.MinimizedNoFocus)
oAccess = New Access.Application
oAccess = GetObject(DatabasePath)
oAccess.PrintReport("Some_Report_Saved_In_MSACCESS")
- I have used this code in several windows applications, both x86 and x64 compiled.
- The reference should be available, but it isn't. Can I get it separately, or can we fix this issue somehow?
What is the project type did you use?
Can you open Access application to create a simple database manually?
For this new database, turn to VBA Editor window-> Tools->Reference-> Is there Microsoft Access 16.0 Object library in it?
In the Access application / database, I can see the Microsoft Access 16.0 Object library, and also all the other Office libraries like Excel 16.0, Outlook 16.0 etc.
So apparently they did get installed. How do I get them to show up in Visual Studio?
- Open Visual Studio Community 2015
version 14.0.25431.01 - New Project
- Templates > Visual Basic > Windows > Windows Forms Application
- Add button to form
- Open Project properties > References
- Add
- Look for Microsoft.Office.Interop.Access (any version)
- Reference is not in the list
- Look for Microsoft Access xx.x Object library
- Reference is not in the list
- No need to proceed further
- Open Visual Studio Community 2015
version 14.0.25431.01 - New Project
- Templates > Visual Basic > Windows > Windows Forms Application
- Add button to form
- Open Project properties > References
- Add
- Look for Microsoft.Office.Interop.Access (any version)
- Reference is not in the list
- Look for Microsoft Access xx.x Object library
- Reference is not in the list
- No need to proceed further
The Microsoft Access x.x library should be visible in the list when the Add Reference COM tab is selected. If it is not visible, then it sounds like you have an installation issue with Office.
The Office PIA is installed through the Visual Studio installation configuration. I believe it's the Office/SharePoint Development option.
Paul ~~~~ Microsoft MVP (Visual Basic)
You were right, all it took was an online repair of Office, and the referenced showed up in Visual Studio.
I am actually trying to do something similar, but the issue is I can not have Office installed on the server so I somehow need to use the object library and run an Excel Macro.
I used ace.12 and I am able to get the excel file and also get its sheet name with the code below:
But I cannot make the Access.Application work at all. Is there any thing I can download and add as a refrence and make it work without installing Office??
Public Sub Main()
Dim fileToTest As String
Dim tableToTest As String
Dim connectionString As String
Dim excelConnection As OleDbConnection
Dim excelTables As DataTable
Dim excelTable As DataRow
Dim currentTable As String
fileToTest = Dts.Variables("ExcelFile").Value.ToString
tableToTest = Dts.Variables("ExcelTable").Value.ToString
Dts.Variables("ExcelTableExists").Value = False
If File.Exists(fileToTest) Then
connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" &
"Data Source=" & fileToTest &
";Extended Properties=Excel 8.0"
excelConnection = New OleDbConnection(connectionString)
excelConnection.Open()
excelTables = excelConnection.GetSchema("Tables")
For Each excelTable In excelTables.Rows
currentTable = excelTable.Item("TABLE_NAME").ToString
MessageBox.Show(currentTable)
If currentTable = tableToTest Then
Dts.Variables("ExcelTableExists").Value = True
End If
Next
End If
Dts.TaskResult = ScriptResults.Success
' Dts.TaskResult = ScriptResults.Success
End Sub
I think your issue is not similar.
In the original post user was using MS Office on local.
You are working without office on server side and want to use Excel and Access Object library.
It is not recommended to use Office interop on server side.
Generally, We suggest developers to use Open XML as an alternative.
So you can also try to check it, Whether it helps you to solve your issue.
If then also you have any further question then I suggest you to create a new thread with detailed information about your issue.
We will try to provide further suggestions to solve the issue.
Note sure why you need "fileInfo" class, but it don't matter.
However, you path name looks wrong. the x32 bit version of Access on a x64 bit machine will be:
"C:\Program Files (x86)\Microsoft Office\root\Office16\MSACCESS.EXE"
So it not clear how your previous code worked, but "most" machines today are x64 bits, and the vast majority of office installs are x32. You thus have to use the
"C:\Program Files (x86)
as a path name to get to the msaccess.exe file.
I have seen a number of "wonkey" setups where the IT folks did not know better and they forced the x32 install into the x64 bit folder (Program Files). Windows does not FORCE this install location, but is only a general accepted location that "most installers respect. (in other words, you can install x32 programs into what is supposed to be reserved for x64 (c:\Program files).
And, it turns out you can also install x64 bit programs into what is supposed to be reserved for x32 (program Files (x86).
So while I seen some IT folks install always and everything into the x64 bit program file, including a mix of x32, and x64 programs (which is allowed), it likely that Access is x32, and it likely that it is installed in c:Program Files (x86).
Читайте также: