ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Kick off access using excel. (https://www.excelbanter.com/excel-discussion-misc-queries/161547-kick-off-access-using-excel.html)

Jeff

Kick off access using excel.
 
Hi,

I am trying to start access using excel and run a macro. There are two
problems.

1.) I get an error when I try to open access on the "Y:" drive. The Y drive
is a shared drive at work that I have access to. My hard drive is drive "C:"

Call Shell("C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE
Y:\Building.mdb")

Error Message = ...
'The command line you used to start Microsoft Office Access contains an
option that microsoft Office Acess doesn't recognize.
'Exit and restart Microsoft Office Access using valid command-line options.

2.) Do you know the syntax to use to start "Macro1" in the database?


Thanks for your help!!


Jeff

Kick off access using excel.
 
One other thing. I get the same error when I copy the database to the C:
drive so the code reads.

Call Shell("C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE
C:\Building.mdb")


Error message is the same .


"Jeff" wrote:

Hi,

I am trying to start access using excel and run a macro. There are two
problems.

1.) I get an error when I try to open access on the "Y:" drive. The Y drive
is a shared drive at work that I have access to. My hard drive is drive "C:"

Call Shell("C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE
Y:\Building.mdb")

Error Message = ...
'The command line you used to start Microsoft Office Access contains an
option that microsoft Office Acess doesn't recognize.
'Exit and restart Microsoft Office Access using valid command-line options.

2.) Do you know the syntax to use to start "Macro1" in the database?


Thanks for your help!!


JW[_2_]

Kick off access using excel.
 
Sub tryThis()
Dim objAcc As Object
On Error GoTo ender
Set objAcc = CreateObject("Access.Application")
objAcc.OpenCurrentDatabase _
"Y:\Building.mdb"
objAcc.Visible = True
With objAcc
.DoCmd.RunMacro ("Macro1")
End With
closer:
Set objAcc = Nothing
Exit Sub
ender:
MsgBox Err.Description
Resume closer
End Sub

Jeff wrote:
One other thing. I get the same error when I copy the database to the C:
drive so the code reads.

Call Shell("C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE
C:\Building.mdb")


Error message is the same .


"Jeff" wrote:

Hi,

I am trying to start access using excel and run a macro. There are two
problems.

1.) I get an error when I try to open access on the "Y:" drive. The Y drive
is a shared drive at work that I have access to. My hard drive is drive "C:"

Call Shell("C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE
Y:\Building.mdb")

Error Message = ...
'The command line you used to start Microsoft Office Access contains an
option that microsoft Office Acess doesn't recognize.
'Exit and restart Microsoft Office Access using valid command-line options.

2.) Do you know the syntax to use to start "Macro1" in the database?


Thanks for your help!!



Jeff

Kick off access using excel.
 
Wow! thanks for your help. What would I do without you guys.



"JW" wrote:

Sub tryThis()
Dim objAcc As Object
On Error GoTo ender
Set objAcc = CreateObject("Access.Application")
objAcc.OpenCurrentDatabase _
"Y:\Building.mdb"
objAcc.Visible = True
With objAcc
.DoCmd.RunMacro ("Macro1")
End With
closer:
Set objAcc = Nothing
Exit Sub
ender:
MsgBox Err.Description
Resume closer
End Sub

Jeff wrote:
One other thing. I get the same error when I copy the database to the C:
drive so the code reads.

Call Shell("C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE
C:\Building.mdb")


Error message is the same .


"Jeff" wrote:

Hi,

I am trying to start access using excel and run a macro. There are two
problems.

1.) I get an error when I try to open access on the "Y:" drive. The Y drive
is a shared drive at work that I have access to. My hard drive is drive "C:"

Call Shell("C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE
Y:\Building.mdb")

Error Message = ...
'The command line you used to start Microsoft Office Access contains an
option that microsoft Office Acess doesn't recognize.
'Exit and restart Microsoft Office Access using valid command-line options.

2.) Do you know the syntax to use to start "Macro1" in the database?


Thanks for your help!!





All times are GMT +1. The time now is 03:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com