Debugging Excel from Access

O

omsoft

I run the following code from Access when a button is clicked.

Set xlApp = New Excel.Application
With xlApp
.Visible = True
Set xlWB = .Workbooks.Open("c:\docs\prototype\PFA
Model.xls", , False)
End With

When Excel is launched, it runs a bunch of code to do some calculations in
ThisWorkbook. In ThisWorkbook, I check for a boolean value in a table to see
if Excel is being invoked from Access (if true, Excel is standalone).

The question is how do I debug both app? I can not seem to get control in
Excel when it opens the file.

Thanks.
 
G

Graham Mandeno

I haven't tried this myself, but you could try putting a Stop command in
your Excel VBA code, which should effectively add a semi-permanent
breakpoint. From there you should be able to step through your Excel VBA.

You might also need to add .UserControl = True after making the Excel app
visible.
 
O

omsoft

Thanks Graham, I will try that.
I launch Excel from Access do some calcs, write rows to a table and quit
Excel.
I can not save breakpoints in VBA so I can not keep that Excel file open.

Graham Mandeno said:
I haven't tried this myself, but you could try putting a Stop command in
your Excel VBA code, which should effectively add a semi-permanent
breakpoint. From there you should be able to step through your Excel VBA.

You might also need to add .UserControl = True after making the Excel app
visible.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

omsoft said:
I run the following code from Access when a button is clicked.

Set xlApp = New Excel.Application
With xlApp
.Visible = True
Set xlWB = .Workbooks.Open("c:\docs\prototype\PFA
Model.xls", , False)
End With

When Excel is launched, it runs a bunch of code to do some calculations in
ThisWorkbook. In ThisWorkbook, I check for a boolean value in a table to
see
if Excel is being invoked from Access (if true, Excel is standalone).

The question is how do I debug both app? I can not seem to get control in
Excel when it opens the file.

Thanks.
 
D

dch3

Anytime that I'm automating one Office app from another, I always build the
code in the native app just so I have access to the VBA help for that
specific file. Also, I'll post in the newsgroup for that specific
application. The fact that you'll be controling that app from within Access
is a moot point when it comes to figuring out why somethings not working or
trying to figure out how to do something.

omsoft said:
Thanks Graham, I will try that.
I launch Excel from Access do some calcs, write rows to a table and quit
Excel.
I can not save breakpoints in VBA so I can not keep that Excel file open.

Graham Mandeno said:
I haven't tried this myself, but you could try putting a Stop command in
your Excel VBA code, which should effectively add a semi-permanent
breakpoint. From there you should be able to step through your Excel VBA.

You might also need to add .UserControl = True after making the Excel app
visible.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

omsoft said:
I run the following code from Access when a button is clicked.

Set xlApp = New Excel.Application
With xlApp
.Visible = True
Set xlWB = .Workbooks.Open("c:\docs\prototype\PFA
Model.xls", , False)
End With

When Excel is launched, it runs a bunch of code to do some calculations in
ThisWorkbook. In ThisWorkbook, I check for a boolean value in a table to
see
if Excel is being invoked from Access (if true, Excel is standalone).

The question is how do I debug both app? I can not seem to get control in
Excel when it opens the file.

Thanks.
 
O

omsoft

Not sure what your point is.

I put stop in the code as Graham suggested and it works.
dch3 said:
Anytime that I'm automating one Office app from another, I always build the
code in the native app just so I have access to the VBA help for that
specific file. Also, I'll post in the newsgroup for that specific
application. The fact that you'll be controling that app from within Access
is a moot point when it comes to figuring out why somethings not working or
trying to figure out how to do something.

omsoft said:
Thanks Graham, I will try that.
I launch Excel from Access do some calcs, write rows to a table and quit
Excel.
I can not save breakpoints in VBA so I can not keep that Excel file open.

Graham Mandeno said:
I haven't tried this myself, but you could try putting a Stop command in
your Excel VBA code, which should effectively add a semi-permanent
breakpoint. From there you should be able to step through your Excel VBA.

You might also need to add .UserControl = True after making the Excel app
visible.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

I run the following code from Access when a button is clicked.

Set xlApp = New Excel.Application
With xlApp
.Visible = True
Set xlWB = .Workbooks.Open("c:\docs\prototype\PFA
Model.xls", , False)
End With

When Excel is launched, it runs a bunch of code to do some calculations in
ThisWorkbook. In ThisWorkbook, I check for a boolean value in a table to
see
if Excel is being invoked from Access (if true, Excel is standalone).

The question is how do I debug both app? I can not seem to get control in
Excel when it opens the file.

Thanks.
 
D

dch3

When your working directly in the application that'll be automated via
Access, you'll have access to intellisense as well as the
application-specific VBA help files.

omsoft said:
Not sure what your point is.

I put stop in the code as Graham suggested and it works.
dch3 said:
Anytime that I'm automating one Office app from another, I always build the
code in the native app just so I have access to the VBA help for that
specific file. Also, I'll post in the newsgroup for that specific
application. The fact that you'll be controling that app from within Access
is a moot point when it comes to figuring out why somethings not working or
trying to figure out how to do something.

omsoft said:
Thanks Graham, I will try that.
I launch Excel from Access do some calcs, write rows to a table and quit
Excel.
I can not save breakpoints in VBA so I can not keep that Excel file open.

:

I haven't tried this myself, but you could try putting a Stop command in
your Excel VBA code, which should effectively add a semi-permanent
breakpoint. From there you should be able to step through your Excel VBA.

You might also need to add .UserControl = True after making the Excel app
visible.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

I run the following code from Access when a button is clicked.

Set xlApp = New Excel.Application
With xlApp
.Visible = True
Set xlWB = .Workbooks.Open("c:\docs\prototype\PFA
Model.xls", , False)
End With

When Excel is launched, it runs a bunch of code to do some calculations in
ThisWorkbook. In ThisWorkbook, I check for a boolean value in a table to
see
if Excel is being invoked from Access (if true, Excel is standalone).

The question is how do I debug both app? I can not seem to get control in
Excel when it opens the file.

Thanks.
 
O

omsoft

What's that got to do with my question?

dch3 said:
When your working directly in the application that'll be automated via
Access, you'll have access to intellisense as well as the
application-specific VBA help files.

omsoft said:
Not sure what your point is.

I put stop in the code as Graham suggested and it works.
dch3 said:
Anytime that I'm automating one Office app from another, I always build the
code in the native app just so I have access to the VBA help for that
specific file. Also, I'll post in the newsgroup for that specific
application. The fact that you'll be controling that app from within Access
is a moot point when it comes to figuring out why somethings not working or
trying to figure out how to do something.

:

Thanks Graham, I will try that.
I launch Excel from Access do some calcs, write rows to a table and quit
Excel.
I can not save breakpoints in VBA so I can not keep that Excel file open.

:

I haven't tried this myself, but you could try putting a Stop command in
your Excel VBA code, which should effectively add a semi-permanent
breakpoint. From there you should be able to step through your Excel VBA.

You might also need to add .UserControl = True after making the Excel app
visible.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

I run the following code from Access when a button is clicked.

Set xlApp = New Excel.Application
With xlApp
.Visible = True
Set xlWB = .Workbooks.Open("c:\docs\prototype\PFA
Model.xls", , False)
End With

When Excel is launched, it runs a bunch of code to do some calculations in
ThisWorkbook. In ThisWorkbook, I check for a boolean value in a table to
see
if Excel is being invoked from Access (if true, Excel is standalone).

The question is how do I debug both app? I can not seem to get control in
Excel when it opens the file.

Thanks.
 

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

Top