• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Find and Replace In VBE how to instruction?

Excelnoub

Member
I have a “DeleteAfterRun” codes that will prompt a first time user to add his personal “UserID”.


How do I record or get a find and replace code that will look in my VBE in all the Workbook either the Sheets, Modules and the Userforms to replace a specific “Text” and replace it by the one that the user inserts in the inputbox? “Current Project”


Example:

If User adds 987 then Find all 123 and replace it with 987 not in the work area but in the VBE.

Therefore, On open prompt the user what is His user ID, then Search in this Current Project all information and replace it with the inputbox entry.


I have so much coding and a First time open then delete is my best way to go.


I don’t need a Find Replace in my Sheet (Row or Column) I need a code to search in the Editor.


Could someone guide me?
 
I have a Master Template that will be use for all users but this will be a cut and paste, therefore I will be copying the template then pasting it in a shared drive with the persons name. This person will be assign with a user ID. Once his ID is assigned to him he will then open his workbook and it will prompt him with a “Please insert your User ID” once this is done it has to look in the Editor for all 123 (my user ID to build this template) then it will replace the 123 to his user ID inserted in the Inputbox.
 
Hi, Excelnoub!

Strange question, weird procedure, unstable performance,...

If I were you I'd implement a sort of user table with UserID, Password, Access level, ... and then make the code to check against it, so I'd be working once.

But if you want to do it anyway then give a look to this link:

http://chandoo.org/forums/topic/macro-code-updating-from-another-macro-if-that-makes-sense

Regards!
 
Thank you SirJB7, I will try to read the code and the thread but I'm not sure I understand...


Does this code search in all module, sheets and forms?


I don't really care about worms and Trojan virus cause we are on a secure network that, my template will be the only one that my division will use. Therefore I'm not to worried about that.


I just need to Change the Text in all my Sheets, userform and modules (no matter what are the names) and add the new one... It's not like I'm changing the codes to crash my template, I have been working to hard to screw this up lol, but if I could find a way to change all user ID by a "runonce" and then "deleteafterrun" code it would save me a lot of time.


Yes I could add another sheet with an sub worksheet change method to find all "Text to be change" and then replace "new text to be replace" based on users but this would mean that someone would need to access this main template and go in and change the users monthly with userID that is unknown at this time.


Some of these users that will be playing around my Template are not what so ever Excel pro or even understand what is a formula...


I made this so User Friendly that even the new comers wont need VBA lessons.


It seems that it is virtually close to impossible to get what I need lol...


BUT I have the runone then delete code lol
 
Hi, Excelnoub!


As you might see in the first 2 lines:

-----

Const ksModule = "Module1"

Const ksProcedure = "test1"`

-----

it works only in a specified procedure of a specified module, but that should be the minor issue: if you're planning to update VBA code from a macro you shouldn't have any problem to adapt it and embed the main part of the code within 2 For...Next structures, one for modules and other for procedures.


The idea was just and only to point out how the update of the VBA code might be updated.


Regards!
 
Back
Top