ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   activeworkbook connections.delete not working (https://www.excelbanter.com/excel-programming/451382-activeworkbook-connections-delete-not-working.html)

bobh

activeworkbook connections.delete not working
 
Hi All,

Hopefully I explain this well......... I have a Excel 2007 spreadsheet which has a data connection to an Access 2007 table. In VB I do a Run Macro1 which does a RefreshAll and then removes the data connection. The disconnect is not working in automation but if I step thru it the disconnect happens. So, I don't understand why it does not work when run as automation but does work in debug mode.

Sub Macro1()
'
ActiveWorkbook.RefreshAll
'
Call Macro2
'
End Sub


Public Sub Macro2()

ActiveWorkbook.Connections("Query from MS Access Database1").Delete

End Sub

thanks
bobh.


All times are GMT +1. The time now is 10:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com