View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Panos Stavroulis. Panos Stavroulis. is offline
external usenet poster
 
Posts: 2
Default database calls

That worked thanks. I still can't see the queries, something with my odbc
set-up but at least now I can see the sql code. Thanks.

"NickHK" wrote:

If there's no direct ADO/DAO calls, what about QueryTables ?
Run this code to see what you get:

Private Sub CommandButton2_Click()
Dim WS As Worksheet
Dim QT As QueryTable
Dim QTCount As Long

For Each WS In ThisWorkbook.Worksheets
For Each QT In WS.QueryTables
Debug.Print QT.Parent, QT.CommandText
QTCount = QTCount + 1
Next
Next

MsgBox "There are " & QTCount & " query tables in this workbook."

End Sub

NickHK

"Panos Stavroulis." wrote in
message ...
Hi,

I am trying fix an error message from the database coming into excel after
you press a button, ie run a macro. It produces some syntax error on the
database and it fails.

I can see that the button is assigned to a macro, then I can see all

macros
and I've searched through them for opening database connections, ie ADO
calls. I can't see anything connecting to a database. Also profiler on SQL
Server doesn't show anything (maybe the request goes to the wrong server?)

I
can't see any external data queries either.

What else is in an excel file that can make calls to a DBMS? Thanks.

Panos.