+ Reply to Thread
Results 1 to 10 of 10

Searching a Closed Workbook ?

  1. #1
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,400

    Searching a Closed Workbook ?

    How would I modify the code below to search a closed workbook, in the same directory as the open workbook (that has the search form) ?

    In the closed workbook, always searching COLUMN A on worksheets #2 & #3, returning data from columns A-J.

    Wanting to keep the closed workbook closed at all times if possible (or at the least, hidden).

    Thank you for your assistance.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Searching a Closed Workbook ?

    I don't think you can search a closed book. You could open it discretely and do it that way.
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,400

    Re: Searching a Closed Workbook ?

    I'll have to make concessions then.

    Can you open a closed workbook but have it VISIBLE = FALSE ?

    In any case, how would I modify the existing code to accomplish my goal (second workbook open or closed) ?

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,400

    Re: Searching a Closed Workbook ?

    Or open it minimized ?
    Last edited by Logit; 08-26-2016 at 09:49 PM. Reason: spelling

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Searching a Closed Workbook ?

    Why not just use a regular formula like vlookup?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,400

    Re: Searching a Closed Workbook ?

    I didn't want to reinvent what I already have.

    I can't get the syntax working, changing "active workbook" to "workbooks" (referring to the closed workbook).

  7. #7
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Searching a Closed Workbook ?

    You can use ADODB and SQL. Search the forum, there are many examples
    If you are pleased with a member's answer then use the Star icon to rate it.

  8. #8
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,400

    Re: Searching a Closed Workbook ?

    #1 Anyone have suggestions to modify my existing code ?

    #2 I don't think VLOOKUP would be wise 'cuz there are just over 1 million entries to search.

    #3 ADOB and SQL are way above my understanding at this time. However, if anyone is kind enough to help, I'd be mighty appreciative !
    I'm willing to learn if you are willing to explain.


    Thank you all for your assistance.

  9. #9
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Searching a Closed Workbook ?

    Your code is incomplete. Where is the FindAll() routine? Chip Pearson has a good one. http://www.cpearson.com/excel/findall.aspx

    There are several ADO methods out there. Ron de Bruin has a routine that can be handy. You would want to modify the SQL I suspect. Since I don't know what your goal is, I can not suggest an SQL string. http://www.rondebruin.nl/win/s3/win024.htm

  10. #10
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,400

    Re: Searching a Closed Workbook ?

    Ken:

    I've attached the project here.

    I did originally leave off the code that is in the Module. Sorry about that ... thought just the UserForm code would be sufficient.

    This project is based on Chip Pearson's example.

    I managed to get it working for a short time when there was only 20 or so rows of data, on WorkSheet2 of this same WorkBook. When complete there will be just over 1 million rows of data to be searched in a separate workbook, always on sheets 2 and 3. Always searching column A of those two sheets.

    Speed in returning the data of the search is paramount, as is using a closed workbook where the data will be stored.

    I've played around with some code to try and hide the second workbook or at least make it invisible while the search is happening. Not alot of success there either. Haven't tried getting the data workbook (#2) minimized (another option).

    I'm looking forward to learning from your suggestions. I'm a newbie with VBA. I've learned alot in the past month, but not enough to get me where I want to go with this project.

    Thank you for your interest.
    Attached Files Attached Files
    Last edited by Logit; 08-27-2016 at 11:06 PM. Reason: presentation

+ 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. Export data with two Criteria values from closed workbook to closed workbooks VBA
    By julielara in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2016, 01:56 PM
  2. need vba to copy sheets from closed workbook and paste into all closed wb's
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-20-2016, 01:25 PM
  3. Matching data from closed workbook with open workbook based on cell values
    By kbkrueger in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2015, 07:42 PM
  4. Update Cell Value from a Closed Workbook to Another Closed Workbook
    By glennchung in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-17-2014, 04:44 PM
  5. Replies: 0
    Last Post: 03-27-2014, 12:38 PM
  6. [SOLVED] Copying data from a closed workbook into an open workbook ignoring excel filter?
    By reach78 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 09-17-2013, 12:31 AM
  7. Copy One Sheet From One Closed Workbook To Another Closed WB
    By teshiburu1988 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-04-2009, 11:49 AM

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