LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Accessing the Data Connection Strings and Command Text (SQL) in VB

I have a number of Excel files that have data connections to various sources,
and I want to be able to read the data connection strings and command text
(SQL) using VBA.

In Access this would be easy to do, creating a database object, and looking
at the QueryDefs. Is there something similar in Excel?

If someone could point me to an on-line reference or provide a code like the
one below, that would be great.

Thank you.

Mark

Private Sub Test()

Dim strMsg As String

Dim db As DAO.Database
Dim qds As DAO.QueryDefs
Dim qd As DAO.QueryDef

Set db = currentdb()
Set qds = db.QueryDefs

For Each qd In qds

Debug.Print qd.Connect & vbTab & qd.Sql

Next

End Sub


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
find and replace numeric strings in larger text strings Mr Molio Excel Worksheet Functions 8 November 9th 11 05:17 PM
Accessing the text of a form command button from underlying macro Chrisso Excel Programming 6 September 15th 07 03:02 PM
list of extended properties for use with ADO connection strings Loane Sharp Excel Programming 6 August 24th 04 09:24 AM
Updating Connection Strings Matt Excel Programming 2 May 21st 04 11:47 AM
Changing Connection Strings Matt Excel Programming 6 May 21st 04 11:45 AM


All times are GMT +1. The time now is 05:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"