Excel - Access Integration

  • Thread starter Thread starter omsoft
  • Start date Start date
O

omsoft

I have an Access DB where I create a dept table from a department selected in
the form.

Then when Show Projects button is pressed in that form, this table/record is
read by a separate Excel workbook and it does some calculations and creates a
report.

I also need to be able to run in Excel workbook standalone. It has its own
UI where if a department is selected, same calculations are done.

How do I know whether the query is coming from Access (press of the button
in the form) or the Excel workbook is opened standalone.

Sorry if this is an Access question. I was not sure.

Thanks,
 
Don't call the Macro directly from Excel. Create a new macro.

Sub New Macro
' Add code here to let you know it was called from Excel

Call Old_Macro
end sub

Sub Old_Macro

'macro to calculate Access data

end sub


Then in the Access code Add similar code to tell you it was called from
Access. One thing may be to Add in the header or in a cell a message to say
whether the code from call from Access or excel.
 
Thanks Joel, that makes sense.

Joel said:
Don't call the Macro directly from Excel. Create a new macro.

Sub New Macro
' Add code here to let you know it was called from Excel

Call Old_Macro
end sub

Sub Old_Macro

'macro to calculate Access data

end sub


Then in the Access code Add similar code to tell you it was called from
Access. One thing may be to Add in the header or in a cell a message to say
whether the code from call from Access or excel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top