Hi All,
Performing and record macro to find the selected string in open .RESX file and get the key and replace it on selection string.Below is the recorded macro with one modification for find what...
The problem with the below macro is that when run it does not copy the key from the .RESX file.
Can you please suggest or refer to achieve this?
Sub genResx()
DTE.ActiveDocument.Selection.Copy()
DTE.Windows.Item("Resources.resx").Activate()
DTE.ExecuteCommand("Edit.Find")
DTE.ExecuteCommand("Edit.Paste")
DTE.Find.MatchCase = True
DTE.Find.FindWhat = DTE.ActiveDocument.Selection.Copy()
DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.MatchWholeWord = False
DTE.Find.Backwards = False
DTE.Find.MatchInHiddenText = False
DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral
DTE.Find.Action = vsFindAction.vsFindActionFind
If (DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
Throw New System.Exception("vsFindResultNotFound")
End If
DTE.Windows.Item("Program.cs").Activate()
DTE.ActiveDocument.Selection.Paste()
DTE.ActiveDocument.Save()
End Sub
Thanks & Regards,
ShailShin