RE: Late binding Access from Excel

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi Rick

Yes, I have experienced similar problems, not automating Access from Excel
but other combinations. Allthough MS don't admit it I'm of the opinion that
VBA is being left to flounder as each succusive version of office appears -
perhaps others might want to comment on this. e.g. I tried to upgrade several
different Access applications from 2003 to 2007 but had to revert back to
2003 as several important methods and processes are simply not supported
through 2007. e.g. Replication, a major feature of a couple of my
applications, is not supported under the new Access 2007 file format which I
find astonishing. I get the impression that if VBA fits as new versions are
released, that's fine, if not, then tough - VBA is gradually being erroded.
My guess is that VB will eventually become the MS Office programming language
- afterall VB is VBA's big brother, offering all VBA's functionaility so, if
I were MS, why bother supporting a 'junior' language - I might be way off the
mark here but, if I had any money left after the credit-crunch, I'd bet quite
a bit on being correct!! Sorry to get on my hobby-horse so back to your
question: I always now use late binding when automating other Office
applications. Some of my Access applications automate MS Word and this proves
a logistical nightmare if using early binding as my users may have any of the
MS Word versions on their systems. I did revert to shipping the applications
with a 'batch' of Word library files inserting the appropriate file on
installation but this proved difficult - e.g. it all works well until the
users upgrades Word at which point automation fails. MS say that late binding
causes some performace issues but I've never noticed any so, my advice would
be to go for the late binding option whenever possible.

Anyone else got any views on the above?

Cheers.

BW

"Rick" wrote:

Thanks!

I'm working and coding in Office 2003. I've read (primarily from Microsoft)
that since I'm coding my apps in an earlier version (2003), that my early
binding should work fine for users of 2007. However, I've had problems.
That's why I'm converting my early bindings to late bindings. Have you
experienced similar problems? Why would Microsoft make such a statement?

Thanks again.


"BeWyched" wrote:

You are opening an Access container but not telling the system which Access
database to load.

Try:

...
Set acApp = GetObject(, "Access.Application")
acApp.OpenCurrentDatabase "path to database\name.mdb"
acApp.Run "DailyReport"

Good luck.

BW

"Rick" wrote:

I'm using late binding to avoid problems with different user versions of
Access 2003 and 2007. I'm automating Access from Excel, so my code is in
Excel. I removed my reference to Access in VBA Tools. My code works except
for the statement that calls the Access subroutine as below. I get a 7952
error, "Illegal function call." Help greatly appreciated.

Private Sub cmdPullData_Click()

Dim acApp As Object
Dim ws As Object
Dim dbs As Object
Dim myworkspace As String

'Access automation
Set acApp = GetObject(, "Access.Application")
Set ws = DAO.CreateWorkspace("myworkspace", "admin", "")
Set dbs = ws.OpenDatabase(strDB)

acApp.Run "DailyReport" << get 7952 error, "illegal function call"
...

End Sub

.



Relevant Pages

  • Re: BruteForcing?
    ... "Expect is a tool for automating interactive applications such as ... This is more of a general brute forcing question, but one which I could use some assistance. ...
    (Pen-Test)
  • Re: Entourage / Office 2007 / VBA
    ... I think you may be mis-reading the Microsoft blog on the topic of VBA. ... existing macros that has been making the blog and comment rounds. ... least the automating I've done via Rb doesn't live in the workbook. ... REALbasic automates Office by hooking into the VBA libraries already ...
    (microsoft.public.mac.office)
  • Re: Actual Hours Updated from MS Excel or MS Access
    ... some follow up questions to automating importing data through VBA, ... Project MVP ... I appreciate the automated VBA Tip and did order Rod's book. ... and then open the excel file through File> Open. ...
    (microsoft.public.project)
  • Re: Broken references, disambiguation, and binding
    ... Late binding also adds a severe performance overhead in certain cases. ... if you are automating a complex series of operations in MS Word. ... depending on the references to be checked or corrected. ... disambiguation is only a "code once, ...
    (microsoft.public.access.modulesdaovba)
  • RE: reality canvass: VBA as career? VBA as extra skill in another care
    ... I don't know about an entire career just with VBA, but I think you're on the ... there is a market in automating many of the functions accountants and ... "Matthew Dodds" wrote: ...
    (microsoft.public.excel.programming)