prabha_friend
Board Regular
- Joined
- Jun 28, 2011
- Messages
- 95
Target Code:
Task at Hand:
Change the Recertification Date to Current Date:
Usefull referrences:
Programming In The VBA Editor (search for "Searching For Text In A Module" Section)
https://msdn.microsoft.com/en-us/library/aa260355(v=vs.60).aspx (search for "Finding specific code strings" Section)
Thing Missing in the references:
How to get the start line? The line which holds the being-searched string
("Recertification" in our case)
From the second reference:
Anyother simple ways to achieve this seemingly simple task?
Code:
' Insert Add-In menu with generate button and check trial/retification on workbook open
Private Sub Workbook_Open()
' Call Trail/Rectificaton function
Call objClsGeneral.fnTrial_OR_Recertification_versionCheck("Recertification", "09-Jan-2015", "SomeAppName")
Set objcmd = objMenu.addCommandBar("SomeAppName")
objMenu.jpmAddButton "&Report", "&Report", "sbRun_Main_1041", 1135, objcmd
End Sub
Task at Hand:
Change the Recertification Date to Current Date:
Code:
Call objClsGeneral.fnTrial_OR_Recertification_versionCheck("Recertification", CurrentDateHere, "SomeAppName")
Usefull referrences:
Programming In The VBA Editor (search for "Searching For Text In A Module" Section)
https://msdn.microsoft.com/en-us/library/aa260355(v=vs.60).aspx (search for "Finding specific code strings" Section)
Thing Missing in the references:
How to get the start line? The line which holds the being-searched string
("Recertification" in our case)
From the second reference:
How to get the changed StartLine and StartCol?If VB finds code matching the Target argument, it changes StartLine to the line number where it found the match, and StartCol to the column number in the code line where the match begins. Similarly, VB changes EndLine and EndCol to the last line and last column of the match.
Anyother simple ways to achieve this seemingly simple task?