Reference missing when use a Office2013 accde on Office2010 (1 Viewer)

dhlao

Registered User.
Local time
Today, 06:29
Joined
Dec 23, 2014
Messages
37
I create an accde by Access 2013. And "Microsoft Excel 15.0 Object Library" is need and was added.
This accde is suppose to run on those Windows which has Access Runtime 2013 64bit installed.
Problem arise if the Windows have no Office 2013 install. Because "Microsoft Excel 15.0 Object Library" is point to the EXCEL.EXE inside the install location of Office 2013.

Anyway to solve this problem without install the Office 2013 at the target Windows ?
 

Cronk

Registered User.
Local time
Today, 23:29
Joined
Jul 4, 2013
Messages
2,774
Try late binding which will create the Excel object based on the office installation on the local machine. Change your code to omething like this


dim xlXL as object
dim xlWB as object
dim xlWS as object

set xlXL = CreateObject("Excel.Application")
set xlWB = xlXL.workbooks.add("filename")
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 23:29
Joined
Jan 20, 2009
Messages
12,856
Try late binding which will create the Excel object based on the office installation on the local machine. Change your code to omething like this

dim xlXL as object
dim xlWB as object
dim xlWS as object

set xlXL = CreateObject("Excel.Application")
set xlWB = xlXL.workbooks.add("filename")

Also note with Late Binding that the Excel Enums need to be included as constants. You only need to include the ones you actually used in the code.

I usually design with the objects defined by the Reference so that Intellisense works.

Dim xlXL As Excel.Application
Dim xlWB As Excel.Workbook
Dim xlWS As Excel.Worksheet

These lines will still work with the objects Set through Late Binding.
Set xlXL = CreateObject("Excel.Application")


Then just before deployment comment out the Excel objects by changing the Dims to:

Dim xlXL As Object ' Excel.Application
Dim xlWB As Object ' Excel.Workbook
Dim xlWS As Object ' Excel.Worksheet

This leaves the definition in place as a useful comment and can be done with find and replace throughout the whole project.

eg Replace "As Excel.Application" with "As Object ' Excel Application"
 

dhlao

Registered User.
Local time
Today, 06:29
Joined
Dec 23, 2014
Messages
37
Just tried. But prompt error 429 ActiveX component can't create object
Can "CreateObject" works in 64bit Access ?
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 23:29
Joined
Jan 20, 2009
Messages
12,856
I would have expected Late Binding to solve the problem. Could it be 32/64 bit issue?

You could try installing the older version of Office. Then in the References, put it below the later version so that computers such as yours with the dual install will use the later version and not go through the register step every time you swap.

If it doesn't appear in the references, hit the browse button and find the earlier version exe.
 

Cronk

Registered User.
Local time
Today, 23:29
Joined
Jul 4, 2013
Messages
2,774
Works for me on a 64 bit PC, admittedly Access 2010

Compile your code. You do have Excel on that PC?
 

dhlao

Registered User.
Local time
Today, 06:29
Joined
Dec 23, 2014
Messages
37
Debug > Compile has no error. But when the app need to deal with Excel, error 429 show and indicate the error at
Code:
set xlXL = CreateObject("Excel.Application")
Didn't try to install an older Office on the same Windows.
 

Users who are viewing this thread

Top Bottom