+ Reply to Thread
Results 1 to 4 of 4

Excel queries and connections

  1. #1
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Excel queries and connections

    Does anyone here know of a way to do a "find and replace" in excel queries? My workbook has about 40 queries and I want to see if there's a fast way to tweak the settings on each one.
    Thanks

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,885

    Re: Excel queries and connections

    Depends on what property you need to edit.

    Connections can be looped via VBA code. But what properties are accessible will depend on type of query/connection.

    Some thing like below, to get name of each connection.
    Please Login or Register  to view this content.
    Edit: by using cn.Type you can get what type of connection.
    Ex: 1 = xlConnectionTypeOLEDB, 7 = xlConnectionTypeMODEL

    See link for list.
    https://msdn.microsoft.com/en-us/lib...ctiontype.aspx
    Last edited by CK76; 02-07-2018 at 11:31 AM. Reason: See Edit:
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: Excel queries and connections

    Thanks.

    Since I had configured the properties of all the queries to have them run every time the workbook is opened, I couldn't open it to create a script. But.. I have a windows VPS, and fortunately the path to the data source changes if I move the workbook to a different machine.

    So now I have it open, and deliberately did not enable outside content when it opened. So now I think I could run the VBA code.

    I'm retrieving data from two sources: about 20 xml tables, and 20 tables from a mysql database. the reference you cited doesn't show mysql as one of the connection types though. I wonder if Data Feed would be the best choice?

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,885

    Re: Excel queries and connections

    If data base, it's likely ODBC or OLEDB.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Does My VBA Code To Refresh CSV Power Query Connections Need To Change for MySQL Queries?
    By beaglesBuddy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2017, 02:57 PM
  2. Excel connections to Access Queries not working
    By Geetarzan in forum Excel General
    Replies: 1
    Last Post: 01-16-2016, 05:23 PM
  3. Replies: 3
    Last Post: 08-23-2013, 03:54 PM
  4. Replies: 0
    Last Post: 01-21-2013, 12:47 PM
  5. Embedded Access queries in Excel - if the database moves, how to update queries?
    By Paul_mcc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-06-2012, 07:52 PM
  6. dynamic connections in excel?
    By dennism in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-16-2005, 06:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1