Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I am writing an excel macro that would do various things, and at the end I would like for it to open up an Access Database. This database would then run an autoexec macro and print reports. Is it possible to write code in VBA to open an Access Database? And what would the line of code be to do this? Any help is much appreciated! THANKS! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way:
Copy the following function into a standard code module and call like so: Sub TestLoad() 'your code Call AccessLoadApplication 'your other code end sub Public Function AccessLoadApplication() 'LOAD ACCESS APPLICATION Static appXS As Object Set appXS = CreateObject("Access.Application") appXS.Visible = True End Function HTH "dj" wrote: Hello, I am writing an excel macro that would do various things, and at the end I would like for it to open up an Access Database. This database would then run an autoexec macro and print reports. Is it possible to write code in VBA to open an Access Database? And what would the line of code be to do this? Any help is much appreciated! THANKS! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
THANKS!!!
"XP" wrote: One way: Copy the following function into a standard code module and call like so: Sub TestLoad() 'your code Call AccessLoadApplication 'your other code end sub Public Function AccessLoadApplication() 'LOAD ACCESS APPLICATION Static appXS As Object Set appXS = CreateObject("Access.Application") appXS.Visible = True End Function HTH "dj" wrote: Hello, I am writing an excel macro that would do various things, and at the end I would like for it to open up an Access Database. This database would then run an autoexec macro and print reports. Is it possible to write code in VBA to open an Access Database? And what would the line of code be to do this? Any help is much appreciated! THANKS! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Dim dbnorthwind As DAO.Database Dim dpath As String dbpath = "C:\Program Files\Microsoft Office\OFFICE11\sAMPLES\northwind.mdb" Set dbnorthwind = OpenDatabase(dbpath) Dim rseployees As DAO.Recordset Dim rscustomers As DAO.Recordset Set rseployees = dbnorthwind.OpenRecordset("employees", dbOpenTable) Set rscustomers = dbnorthwind.OpenRecordset("customers", dbOpenTable) i = 2 With rseployees If Not .EOF Then .MoveFirst Do While Not .EOF Cells(i, 1).Value = .Fields(2) Cells(i, 2).Value = .Fields(1) MoveNext i = i + 1 Loop End With -- amrezzat ------------------------------------------------------------------------ amrezzat's Profile: http://www.excelforum.com/member.php...o&userid=28766 View this thread: http://www.excelforum.com/showthread...hreadid=540002 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Mon, 8 May 2006 16:41:00 -0500, amrezzat
wrote: Set dbnorthwind = OpenDatabase(dbpath) You will also need to set a VBA Tools - References... to Microsoft DAO 3.6 Object Library. Don <www.donwiss.com (e-mail link at home page bottom). |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Open Access Database from Excel | Excel Programming | |||
Open Access Database through Excel | Excel Programming | |||
How do I open Access database from Excel | Excel Programming | |||
Can't re-open Access database from Excel VBA | Excel Programming | |||
Open Ms Access database with excel macro | Excel Programming |