View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
bac bac is offline
external usenet poster
 
Posts: 76
Default Run Access Macro from within Excel

yes..

here is an app I use frequently

After updating and reviewing a monthly data sheet, when the user exits the
data is autoamtivcally moved into an access table and access does some stuff
befire returning here to close Excel

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim accFil As Object

DR_Name = Sheets("Audit").Cells(8, "I").Value

'Cell(I8) of the template gets the Excel file name to be imported during
processing 'So if we have a name here then we need to import otherwise we're
not ready to import so exit

If Len(Trim(DR_Name)) <= 1 Then Exit Sub

Set accFil = CreateObject("Access.application")

With accFil.Application
.Visible = True
.Application.OpenCurrentDatabase ("FCSRecon.mdb")

.Run ("Monthly_Import")
'After importing Acces will return here to close Excel + But Access will
remain open
End With
'Close Excel
Application.Quit
End Sub

Please rate this post below

thanx

bc


"Thebeej" wrote:

I am new to macro programming. It is possible to run an Access Macro from an
Excel spreadsheet? Can you open Access, run the macro, close Access from the
spreadsheet?