Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How do I open an Access file with a macro in Excel?

I need a Microsoft Excel macro that will open an existing Microsoft Access
database file. I have written a macro that lets me open a new Access file,
but can't open an existing file. Please Help.
P.S. It would be nice if I could run the macro that exists in Access through
excel as well!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default How do I open an Access file with a macro in Excel?

Try this gaitkeeper

Sub test()
On Error Resume Next
Set ac = GetObject(, "Access.Application")
If ac Is Nothing Then
Set ac = GetObject("", "Access.Application")
ac.OpenCurrentDatabase "C:\My Documents\db1_2K.mdb"
ac.UserControl = True
End If
AppActivate "Microsoft Access"
End Sub

Sub test2()
On Error Resume Next
Set xl = GetObject(, "Excel.Application")
If xl Is Nothing Then
Set xl = GetObject("", "Excel.Application")
xl.Workbooks.Open "c:\Data\book1.xls"
xl.UserControl = True
xl.Visible = True
End If
AppActivate "Microsoft Excel"
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"gaitkeeper" wrote in message ...
I need a Microsoft Excel macro that will open an existing Microsoft Access
database file. I have written a macro that lets me open a new Access file,
but can't open an existing file. Please Help.
P.S. It would be nice if I could run the macro that exists in Access through
excel as well!



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
Macros - Open an access file from de Excel? Teresa Barrocas Excel Discussion (Misc queries) 1 November 3rd 09 12:53 PM
How can I open an Access adp file from excel? revelatgc Excel Discussion (Misc queries) 0 February 25th 05 04:37 PM
How can I open an Access adp file from excel? gcordoba Excel Discussion (Misc queries) 0 February 25th 05 04:37 PM
Trying to open an Excel file from VBA Access donnie100 Excel Programming 0 September 13th 04 07:19 PM
Open Ms Access database with excel macro Sani Excel Programming 2 November 19th 03 06:06 AM


All times are GMT +1. The time now is 11:08 PM.

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

About Us

"It's about Microsoft Excel"