+ Reply to Thread
Results 1 to 4 of 4

Querying another closed Workbook using SQL using ADODB connection

  1. #1
    Registered User
    Join Date
    09-27-2012
    Location
    Mumbai, IN
    MS-Off Ver
    Office 365
    Posts
    97

    Querying another closed Workbook using SQL using ADODB connection

    Hi Guys,

    I have a variable which stores the Username - strUsrNm. What I want is to search this strUsrNm in the Column A of a closed workbook in another location and get me the entire row.

    What I want to achieve by doing is is, when a user open my macro enabled file, his username is stored in strUsrNm at open by using environ($username). And i want to get his details like his phone number, email address, manager name, shift time etc from another excel file.

    Here is how far I have reached:
    Please Login or Register  to view this content.
    What I dont know is how do I get that information using SQL. Please help!!!

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Querying another closed Workbook using SQL using ADODB connection

    Something like
    Please Login or Register  to view this content.
    Where sheet1 is the sheet name and name is the field name.

  3. #3
    Registered User
    Join Date
    09-27-2012
    Location
    Mumbai, IN
    MS-Off Ver
    Office 365
    Posts
    97

    Re: Querying another closed Workbook using SQL using ADODB connection

    I pasted your line of code, It runs perfectly, however how do I get that data in a variable so that it can be put in appropriate places??
    Last edited by yoursamrit2000; 05-15-2019 at 08:59 PM.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: Querying another closed Workbook using SQL using ADODB connection

    It depends on how you want it.
    e.g
    Please Login or Register  to view this content.

+ 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. How to revers this Macro to Pull Data from closed workbook with ADO.Connection
    By nordicdust in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-19-2018, 04:06 PM
  2. Trailing Characters/Space when querying via ADODB.recordset getrows
    By Jay-T in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-27-2016, 08:53 AM
  3. ADODB connection - Changing connection path via fileDialog
    By cajand in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2015, 08:06 AM
  4. Export data from closed workbook to active workbook with ADO connection
    By Naresh27 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-09-2013, 01:08 PM
  5. Get data from closed workbook - ADO connection
    By marzook in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-11-2013, 01:43 AM
  6. ADODB Connection from different workbook
    By Roshan10043 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-02-2013, 11:24 PM
  7. ADODB.Connection Closed due to .commandtext changing from original
    By gwsampso in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-23-2012, 07:07 PM

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