Consulting

Page 1 of 2 1 2 LastLast
Results 1 to 20 of 35

Thread: Solved: Search for Missing Module/Code?

  1. #1

    Solved: Search for Missing Module/Code?

    I am looking for some code/program that will locate a Sub via a keyword search on my entire system. I have closed/lost or deleted a particular Sub I would like not to have to re-create....
    I have looked through the KBase and did a keyword search "Find Module" w/out any results. I know Johnske has some code that will store Modules but not sure if this will handle satisfy my needs, but I cannot remember his KBase article to look for it.

    Thanks,

    YLP
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  2. #2
    As long as your project is not protected then a standard file search would fit the bill
    Start > Search > All Files And Folders > "A Word Or Phrase In The File" (YOUR KEYWORD)

    Don't forget you can specify only .xls files
    Only search All Drives if you think it could be in any of them
    Remember to add network drives you need to search also
    Keep a screen print of ALL likely candidate search returns
    2+2=9 ... (My Arithmetic Is Mental)

  3. #3
    Hello Helli-
    Sorry I could not get that to work. I have tried this previously, but was unsuccessful.
    My approach- I have a Sub named Dec2Frac:
    Sub Dec2Frac ()
    I did a Windows search on the file *.xls and in the box- "a word or phrase in the file" I entered dec2frac.
    The search yielded no results.
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    That should work Doug. I just tried it on my machine, and it worked fine. Didn't even seem to be case-sensitive.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    Moderator VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,184
    Location
    Hi YellowLabPro,

    The below function will take a number in decimals of an inch, return a string in the format "12'-3 3/16", if iInches is True then "147 3/16". None of the Variables are dimensioned as they should be, this is something that I butchered in a hurry (I don't know why I was in a hurry). If you can't find yours we might be able to modify this if you would like.
    [vba]
    Public Function GenFraction$(iAnum, Optional iInches = False)
    mFRC = Split( _
    " 1/16, 1/8, 3/16, 1/4, 5/16, 3/8, 7/16, 1/2, 9/16, 5/8, 11/16, 3/4, 13/16, 7/8, 15/16", ",")
    mFt = "'-"
    mBNUM = iAnum / 12
    mINUM = Int(Round(mBNUM, 4))
    mCNUM = mBNUM - mINUM
    mCNUM = Round(mCNUM, 6) * 12
    mMyInch = Int(mCNUM)
    mFRAC = mCNUM - mMyInch
    mFRAC = Round(mFRAC, 6)
    mIFRAC = CInt((Round(mFRAC, 6) * 16))
    If mIFRAC >= 16 Then
    mMyInch = mMyInch + 1
    mIFRAC = mIFRAC - 16
    If mMyInch >= 12 Then
    mMyInch = mMyInch - 12
    mINUM = mINUM + 1
    End If
    Else
    If mIFRAC > 0 Then
    mIFR = mFRC(mIFRAC - 1)
    End If
    End If
    If mINUM > 0 Then
    mAFRAC = CStr(mINUM) & mFt
    ElseIf mMyInch > 9 Then
    mAFRAC = "0" & mFt
    End If
    If mMyInch > 0 Then
    mAFRAC = mAFRAC & CStr(mMyInch)
    ElseIf mMyInch = 0 And Not IsEmpty(mAFRAC) Then
    mAFRAC = mAFRAC & CStr(mMyInch)
    ElseIf mMyInch = 0 And mINUM > 0 Then
    mAFRAC = mAFRAC & CStr(mMyInch)
    End If
    If mIFRAC > 0 Then mAFRAC = mAFRAC & mFRC(mIFRAC - 1)
    If Not iInches Then
    GenFraction = IIf(IsEmpty(mAFRAC), "0", Trim$(mAFRAC))
    Else
    GenFraction = CStr(Int(iAnum)) & mIFR
    End If
    End Function

    [/vba]

  6. #6
    Tommy,
    Did you mean to post this here or in my other thread: For-Next Loop?
    http://www.vbaexpress.com/forum/show...805#post107805
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  7. #7
    Moderator VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,184
    Location
    Ummm no to the other thread.

    I had the code to convert from decimals of and inch to a fraction string LOL since I'm not being short sighted (hopefully). How would you like the fraction to appear? (I know this may be obviouse, but I am still thinking feet LOL)

  8. #8
    Quote Originally Posted by xld
    That should work Doug. I just tried it on my machine, and it worked fine. Didn't even seem to be case-sensitive.
    Hmmmm- I tried it several times and no success.
    I tried it w/ specific text and modules I know exist, even while they were open, but no results were found.
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  9. #9
    Tommy, you are STILL on the wrong thread.

    YLP, what does the Pro signify ?
    What OS are you running ?
    What access rights do you have as a user when running this ?
    Try putting a simple .xls in say your C:\ and search for a word in the code base from there if that works then you have a different problem. Have you tried searching for something you "KNOW" is in a particular file & location ?
    2+2=9 ... (My Arithmetic Is Mental)

  10. #10
    Heli-
    Pro is shortened project- my nickname for "Maggie" my Yellow Lab. When registering it did not allow me to use the full name, though I see you have been able to convince the Name "Gods" from above differently.... must be that flying higher in your stealth copter.... :-)

    I am running XP
    Administrator Rights
    Show Hidden Folders and Files is enabled
    If there are more settings to access rights, I am not familiar w/ these
    I have not put a .xls, but rather a *.xls and searched for the following strings; dec2frac, sub dec2frac, Item In Array; in C:, C:H:, and MyComputer as the location to search.
    Could there be a setting I am missing?

    Regards,
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  11. #11
    As I suggested put something you KNOW is there in C:\ and if it can't find that then you have BIG problems, get back to us.
    2+2=9 ... (My Arithmetic Is Mental)

  12. #12
    Heli,
    What file type does Windows find when searching for a Sub term, an regular Excel file, or something different?
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  13. #13
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    It is looking in a regular xls file, prior to 2007.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  14. #14
    Quote Originally Posted by YellowLabPro
    Heli,
    What file type does Windows find when searching for a Sub term, an regular Excel file, or something different?
    What ?

    I used this technique in February to find a piece of code I written to perform mathematical operations on cells depending on their formatting so I know it worked then. I have just repeated said technique in a particular folder of a particular drive with a particular .xls file with a particular subroutine placed in it and though it will find it if you place the search word in a cell it won't if you put it in a module.
    Is this another microsoft security enhancement ?
    2+2=9 ... (My Arithmetic Is Mental)

  15. #15
    Heli,
    The Good & The Bad:
    The Good first: glad you found the same results I did, I like most have a VBA addiction now, but I not like everyone else struggle with it still..., losing my hair from learning this is one thing, but pulling it out HURTS!
    The Bad: That is still what I had found, that it does not return a search of entered value in a module. Now Xld is still reporting that this works for him- we need to grill him to see what special super powered software he has and wrestle him for it- though he will probably put a respectable fight...
    I am going to run this again- If Xld = True, Then True....

    I will post back. If we enivitably find this not to be true then we need to invent a method for searching for Subs.
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  16. #16
    Tommy,
    I finally figured out what you were doing.... The module I was searching for had nothing to do w/ feet/inches nor sizing, I just happened to post two threads close in time to one another and you must have summized I was looking for this...
    Me and Heli were completely confused....
    [qoute]think you meant to post this to my other thread:
    http://www.vbaexpress.com/forum/show...805#post107805[/quote]
    Though this did not address a current need it is something potentially very useful and powerful. I am going to save this for future reference/use as I will be working on another situation w/ ft and in.

    Thank you for whipping this out. (I have to get back to your other posts to work on those- thanks for taking the time to help!

    Doug

    Quote Originally Posted by Tommy
    Hi YellowLabPro,

    The below function will take a number in decimals of an inch, return a string in the format "12'-3 3/16", if iInches is True then "147 3/16". None of the Variables are dimensioned as they should be, this is something that I butchered in a hurry (I don't know why I was in a hurry). If you can't find yours we might be able to modify this if you would like.
    [vba]
    Public Function GenFraction$(iAnum, Optional iInches = False)
    mFRC = Split( _
    " 1/16, 1/8, 3/16, 1/4, 5/16, 3/8, 7/16, 1/2, 9/16, 5/8, 11/16, 3/4, 13/16, 7/8, 15/16", ",")
    mFt = "'-"
    mBNUM = iAnum / 12
    mINUM = Int(Round(mBNUM, 4))
    mCNUM = mBNUM - mINUM
    mCNUM = Round(mCNUM, 6) * 12
    [/vba]
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  17. #17
    He probably doesn't have any super powered software, he was just probably more descerning when it came to which superfluous updates he chose from microsoft. I'll try this using Win98 and Linux and report back.
    2+2=9 ... (My Arithmetic Is Mental)

  18. #18
    Ok... thanks.
    I did try searching specifically on a value in a Sub.
    I used "Set Wsv"
    Which is specific to a Sub and not in an Excel file cell. I placed this file on my desktop and confined my search to this location to reduce the search time. NO GO! Did not find.
    So Bob... let us know what magic dust you are using...
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  19. #19
    Moderator VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,184
    Location
    I think the modules and such that are stored in an .xls file are encrypted so the search functions will not work, they look for ASCII text. grep (in Linux) is looking for ASCII also so it wouldn't work either AFAIK even if you imported it into OpenOffice/StarOffice.... The only way is what xld is thinking (I'm assuming here so don't kill me LOL) is if the modules etc, were exported to an external file.

  20. #20
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Here is another post that I did that didn't make it.

    I think your problem is in looking for keywords, like Set. I believe that VBA tokenizes keywords (I would have to check to be sure, but I think that is so), so you won't find Set Wfsv, it will be stored as <token> Wfsv.

    Try doing a search for a procedure name and see if that works.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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