Why this simple task is seriously difficult?

prabha_friend

Board Regular
Joined
Jun 28, 2011
Messages
95
Target Code:
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:
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.
How to get the changed StartLine and StartCol?

Anyother simple ways to achieve this seemingly simple task?
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top