M
Matilda
Hi All,
I found help in this forum in doing this, but need help to understand why it
won't work in my case!
I want my Excel output from Access to have some actions performed on it
which is in code in Personal.xls. I want to call this code from Access, and
have modified code from here to look like this:
Dim xlApp As Variant
Dim xlBookSourceCode, xlBookTarget As Variant
Set xlApp = CreateObject("Excel.Application")
Set xlBookSourceCode = xlApp.Workbooks.Open("C:\Documents and
Settings\[usrname]\Application Data\Microsoft\Excel\XLSTART\PERSONAL.XLS")
Set xlBookTarget = xlApp.Workbooks.Open("C:\Monthly
reports\TestReport\First.xls")
xlApp.Run "sub ChangeFormats()"
xlApp.Application.Visible = True
xlBookSourceCode.Close
xlBookTarget.Close '(False)
xlApp.quit
Set xlApp = Nothing
Set xlBook = Nothing
The target file (and I think Personal.xls) open but the code does not
execute.
I have OLE Automation
COM + Services Type Library
MS Excel 11.0 Object Lib
in my Access references, and
MS Access 11.0 Object Lib in Excel refs.
Also, I notice that when I open Excel from the desktop, the files are still
open and both target and Personal.xls prompt a Read Only message.
I think I have tried everything ...
Any help appreciated,
Matilda
I found help in this forum in doing this, but need help to understand why it
won't work in my case!
I want my Excel output from Access to have some actions performed on it
which is in code in Personal.xls. I want to call this code from Access, and
have modified code from here to look like this:
Dim xlApp As Variant
Dim xlBookSourceCode, xlBookTarget As Variant
Set xlApp = CreateObject("Excel.Application")
Set xlBookSourceCode = xlApp.Workbooks.Open("C:\Documents and
Settings\[usrname]\Application Data\Microsoft\Excel\XLSTART\PERSONAL.XLS")
Set xlBookTarget = xlApp.Workbooks.Open("C:\Monthly
reports\TestReport\First.xls")
xlApp.Run "sub ChangeFormats()"
xlApp.Application.Visible = True
xlBookSourceCode.Close
xlBookTarget.Close '(False)
xlApp.quit
Set xlApp = Nothing
Set xlBook = Nothing
The target file (and I think Personal.xls) open but the code does not
execute.
I have OLE Automation
COM + Services Type Library
MS Excel 11.0 Object Lib
in my Access references, and
MS Access 11.0 Object Lib in Excel refs.
Also, I notice that when I open Excel from the desktop, the files are still
open and both target and Personal.xls prompt a Read Only message.
I think I have tried everything ...
Any help appreciated,
Matilda