Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default Call a VBA module from Microsoft Access

Freddy

The answer is certainly yes, but you will get better answers in an Access
group. this one is Excel

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Freddy" wrote in message
...
Is it possible to call a Visual Basic module from a Microsoft Access
database? Does anyone have sample code? My goal is to create a user menu
interface whereby different VBA modules are called depending on a button
that
is "clicked" on an Access menu.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default Call a VBA module from Microsoft Access

Freddy

That may be tricky, automating Excel from VBA modules in Access would almost
certainly be possible

You are clicking a menu in a toolbar in Access, what are you then looking
for Excel to do?

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Freddy" wrote in message
...
Just for clarity, my plan is to call VBA modules written in Microsoft
Excel
from a Microsoft Access menu interface. Is your answer still the same?

"Nick Hodge" wrote:

Freddy

The answer is certainly yes, but you will get better answers in an Access
group. this one is Excel

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Freddy" wrote in message
...
Is it possible to call a Visual Basic module from a Microsoft Access
database? Does anyone have sample code? My goal is to create a user
menu
interface whereby different VBA modules are called depending on a
button
that
is "clicked" on an Access menu.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default Call a VBA module from Microsoft Access

Freddy

This code was in a module in Access, (Should be simple to set a toolbar in
Access to run a module). It starts Excel and fires a macro called test in my
personal.xls (I have truncated the path to my personal.xls for readability).
The module in personal.xls only showed a messagebox, so that will be the
next thing for you to handle.

This uses early binding so you will need to set a reference to the MS Excel
object library in the VBE in Access (Under ToolsReferences...)

Sub AutomateExcelFromAccess()
Dim xlApp As Excel.Application
Dim xlWb As Excel.Workbook
Set xlApp = New Excel.Application
xlApp.Visible = True
Set xlWb = xlApp.Workbooks.Open("C:\Users\...\XLSTART\Persona l.xls")
xlApp.Run "PERSONAL.XLS!test"
xlWb.Close SaveChanges:=False
Set xlWb = Nothing
xlApp.Quit
Set xlApp = Nothing
End Sub

Module in personal.xls

Sub test()
MsgBox "Run from Access"
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Freddy" wrote in message
...
I want Excel to run a custom Excel macro that's in my Personal.xls file.

"Nick Hodge" wrote:

Freddy

That may be tricky, automating Excel from VBA modules in Access would
almost
certainly be possible

You are clicking a menu in a toolbar in Access, what are you then looking
for Excel to do?

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Freddy" wrote in message
...
Just for clarity, my plan is to call VBA modules written in Microsoft
Excel
from a Microsoft Access menu interface. Is your answer still the same?

"Nick Hodge" wrote:

Freddy

The answer is certainly yes, but you will get better answers in an
Access
group. this one is Excel

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Freddy" wrote in message
...
Is it possible to call a Visual Basic module from a Microsoft Access
database? Does anyone have sample code? My goal is to create a user
menu
interface whereby different VBA modules are called depending on a
button
that
is "clicked" on an Access menu.



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
macro in excel to call a access module to run. [email protected] Excel Discussion (Misc queries) 0 April 23rd 07 08:59 PM
Module call RJH Excel Programming 4 September 7th 06 06:04 AM
Call a Module mb Excel Programming 2 October 26th 05 01:12 AM
Call other sub in the same module yangyh[_4_] Excel Programming 1 September 11th 05 09:24 AM
how to call Access function&module in Excel VBA?? miao jie Excel Programming 1 July 24th 04 04:49 PM


All times are GMT +1. The time now is 04:03 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"