A brief overview of the system I am devloping is an Access data repository system, that feeds into Excel where the report writing is done. (I know Access can report write, but everyone who uses the system (including me) is happier with Excel).
I have a functioning Access system that automatically checks and imports the latest data on auto_open. This has built into it an Excel controlling system as there is data manipulation to be done before importing data and all the data feeds are Excel based.
I now want to control all of this from the Reporting end of the system (Excel). HOwever, I get the Excel Reporting code to open and run access OK, but then when Access opens Excel again it seems to open all the files in Read-Only Format, which is causing errors when the sheets are to be imported into Access
Below is the Excel controlling Access code . . .
and here is the code in Access for controlling Excel . . .
I'm sure this is clear as mud.
(1) Do I not want the creation of the Excel Application in the access code as I already have an excel application running . . .
(2) Is this because the Excel code called by Access is not in the original Excel front-end as well?
Thanks
I have a functioning Access system that automatically checks and imports the latest data on auto_open. This has built into it an Excel controlling system as there is data manipulation to be done before importing data and all the data feeds are Excel based.
I now want to control all of this from the Reporting end of the system (Excel). HOwever, I get the Excel Reporting code to open and run access OK, but then when Access opens Excel again it seems to open all the files in Read-Only Format, which is causing errors when the sheets are to be imported into Access
Below is the Excel controlling Access code . . .
Code:
Set acapp = CreateObject("Access.Application")
dbname1 = databasename
dbname2 = databasename
Set wkbk = ThisWorkbook
acapp.Visible = True
'Open database
acapp.OpenCurrentDatabase (dbname1)
'TotalControl imports all data from Excel to Access
acapp.Run "TotalControl"
acapp.closecurrentdatabase
'Exit access
acapp.Quit
Set acapp = Nothing
and here is the code in Access for controlling Excel . . .
Code:
Set xlApp = CreateObject("excel.application")
xlApp.Visible = True
xlApp.displayalerts = False
'Open excel file
xlApp.workbooks.Open ("filename")
With xlApp
'do stuff
End With
(1) Do I not want the creation of the Excel Application in the access code as I already have an excel application running . . .
(2) Is this because the Excel code called by Access is not in the original Excel front-end as well?
Thanks