?
Solved

References and late binding running access 2007 runtime app on XP/Office 2003 PC and mcscomctl.oxc

Posted on 2011-09-29
1
Medium Priority
?
293 Views
Last Modified: 2012-05-12
I have the following references selected (see screen shot)  in various access2007 runtime  applications which seem to run OK on various XP machines with Office 2003 installed.

I think this is because I am using late binding. Attached is a code snip which is using late binding

   References
So I am using dim myObj as Object

rather than dim myObj As Excel.Application

The reason I am not 100% sure  is that because I cannot tell on my own test XP/Office 11 PC whether I have in the past downloaded  2007 Microsoft Office System Update: Redistributable Primary Interop Assemblies.http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=18346 (I don't think I did - it doesn't spear in the list of programs in the control panel)  BUT I do have the compatibility pack installed.


I know I downloaded mscomctl.ocx the Active X control module to the xp machine a long time ago, as I needed it for some of the applications.: -   But my understanding is I only need this if I use an actrive x control in the application. And anyway XP SP3 has since included this.

Can someone confirm that:

1. As long as I only define objects as above then that prooves I am using late binding throughout and therefore, regardless of the references I have checked in the screen shot I will have no problems with earlier versions of Office or XP regarding references.

2. The office 2007 compatibility pack has no  influence over whether the references are valid - i.e the dlls required are NOT included in the compatibility pack.

3. If 2007 Microsoft Office System Update: Redistributable Primary Interop Assemblies does not appear in my control panel Add or Remove Programs list - then it is not installed.

Thanks Lou


Dim rst As DAO.Recordset
    Dim ApXL As Object
    Dim xlWBk As Object
    Dim xlWSh As Object
    Dim fld As DAO.Field
    Const xlCenter As Long = -4108
    Const xlBottom As Long = -4107
    
    On Error GoTo ITAError
        
    'Do nothing if the form is unbound
    If frm.RecordSource = "" Then
        MsgBox "There are no records in this area of the screen to export.", _
                    vbInformation, "Test App"
        GoTo ITAExit
    End If
    
    
    Set rst = frm.RecordsetClone
    Set ApXL = CreateObject("Excel.Application")
    Set xlWBk = ApXL.Workbooks.Add
    ApXL.Visible = True
        
    Set xlWSh = xlWBk.Worksheets("Sheet1")
    If Len(strSheetName) > 0 Then
        xlWSh.Name = Left(strSheetName, 34)
    End If
    xlWSh.Range("A1").Sele


etc...

Open in new window

0
Comment
Question by:Louverril
1 Comment
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 36814347
Your code snippet above is using Late Binding, and would NOT require a reference to Excel on the target machines.

You don't need to include (or check for) mscomctl.ocx unless your application uses it. This is an ActiveX control, and would be "placed" on a form. If you can compile your app with no errors, then you don't need the reference to that .ocx file.

The Compatibility Pack has no bearing on references. Your user will be required to have some version of Excel on their machine. Otherwise, your code will fail.

It's possible that an installed item will not appear in the Installed Programs listing, but not very likely. Note too that the Interops assemblies are typically used with .NET code, and don't really have any bearing on VBA code.





0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question