find and replace code through another code

  • Hi


    Dont think can be done, but no harm trying



    Is there any way i can write a code, which searches through the code of another file, finds a keyword, and replaces by another


    Please note:I want to search the code not the excel file.



    Aadarsh

    :angrypc:

  • Re: find and replace code through another code


    aadarsh,


    Yes. Go to the help VBA help and search for help on the topic of VBE. This will show you how to access the code for a workbook.

  • Re: find and replace code through another code


    Hi


    Not to be rude, but i know how to access VBE...


    the thing is in code if say i have


    Code
    a="temp"


    Say I want to replace 'temp' with another word say 'ace', i would normally go to find and replace in VBA and do it...


    Now i want to find and replace this section of cod through another code, rather than manually going to find and replace


    Aadarsh

    :angrypc:

  • Re: find and replace code through another code


    aadarsh,


    Ok so by using a macro you can access the VBE envrionment of another workbook. That's half the battle.



    Here's some code that I wrote 3 years ago for exporting code from a workbook to a worksheet. You should be able to modify it to do a string replace



    There was more but this was the meat of the routine.

  • Re: find and replace code through another code


    Thanx


    Am working on it...will put the code up for reference when i am done


    Aadarsh

    :angrypc:

  • Find and replace code through another code - Solution posted


    Hi Barry here is a module i created for making the change


    :angrypc:

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!