Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Check My Code Please - Execute Access Macro

I guess you are not using Access as a front end to an SQL database ?
Then don't use the "OpenAccessProject" method, use "OpenCurrentDatabase"
instead...

--
Regards,
Luc.

"Festina Lente"


"Lythandra" wrote:

Hi,

I'm trying to import in a rather complicated series of queries from Access
into Excel.

I have set a macro up in the Access database which works fine when I run it
from Access.

What I am trying to do is get this macro to run from within a specific Excel
file.

Here is my code which I found on here by searching:

Sub RunAccessMacro()
Dim appAcc As Access.Application
Set appAcc = New Access.Application
appAcc.Visible = True
appAcc.OpenAccessProject ("C:\Test.mdb")
appAcc.DoCmd.RunMacro ("mcr Export To Excel WIP")
appAcc.Quit
Set appAcc = Nothing
End Sub

I have also set a reference up within Excel using (Tools - References -
Microsoft Access 9.0 Object Library).

Now what is happening is that Excel is opening up Access just fine but not
the actual specific database. I have even simplified the database location
and name just to test it.

Does anyone see anything wrong with what I am doing?

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Check My Code Please - Execute Access Macro

Actually that fixed that part. I'm getting anotehr error now but I think I
can get past this one myself.

"PapaDos" wrote:

I guess you are not using Access as a front end to an SQL database ?
Then don't use the "OpenAccessProject" method, use "OpenCurrentDatabase"
instead...

--
Regards,
Luc.

"Festina Lente"


"Lythandra" wrote:

Hi,

I'm trying to import in a rather complicated series of queries from Access
into Excel.

I have set a macro up in the Access database which works fine when I run it
from Access.

What I am trying to do is get this macro to run from within a specific Excel
file.

Here is my code which I found on here by searching:

Sub RunAccessMacro()
Dim appAcc As Access.Application
Set appAcc = New Access.Application
appAcc.Visible = True
appAcc.OpenAccessProject ("C:\Test.mdb")
appAcc.DoCmd.RunMacro ("mcr Export To Excel WIP")
appAcc.Quit
Set appAcc = Nothing
End Sub

I have also set a reference up within Excel using (Tools - References -
Microsoft Access 9.0 Object Library).

Now what is happening is that Excel is opening up Access just fine but not
the actual specific database. I have even simplified the database location
and name just to test it.

Does anyone see anything wrong with what I am doing?

Thanks

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I use VB code to execute macro when double-clicking cell? JDay01 Excel Programming 2 June 13th 06 03:12 PM
macro don't execute a step in the code Shadok Excel Programming 3 December 19th 05 09:52 AM
how to execute macro from vb 6.0 code? B Deepak Excel Programming 4 September 30th 05 07:57 AM
access 97 to excel 97: execute macro automation TC[_3_] Excel Programming 2 July 15th 03 07:38 PM
access 97 to excel 97: execute macro automation Tom Ogilvy Excel Programming 0 July 13th 03 05:16 PM


All times are GMT +1. The time now is 09:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"