我正在尝试在Visual Studio中自动执行查找/替换任务。我使用了宏录制器并得到了下面的代码。运行宏时,它似乎没有任何效果。 (我尝试使用快速替换和替换文件但没有成功)。我不知道有什么不对。有人可以帮忙吗?
Option Strict Off
Option Explicit Off
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Public Module RecordingModule
Sub CommaSpace()
DTE.Find.Target = vsFindTarget.vsFindTargetFiles
DTE.Find.MatchWholeWord = False
DTE.Find.Action = vsFindAction.vsFindActionFindAll
DTE.Windows.Item("{CF2DDC32-8CAD-11D2-9302-005345000000}").Activate() 'Find and Replace
DTE.Find.MatchCase = False
DTE.Find.Action = vsFindAction.vsFindActionReplaceAll
DTE.Windows.Item("Eigen3x3.cpp").Activate()
DTE.Find.FindWhat = ","
DTE.Find.ReplaceWith = ", "
DTE.Find.Target = vsFindTarget.vsFindTargetFiles
DTE.Find.MatchCase = False
DTE.Find.MatchWholeWord = False
DTE.Find.MatchInHiddenText = True
DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral
DTE.Find.SearchPath = "Entire Solution"
DTE.Find.SearchSubfolders = True
DTE.Find.KeepModifiedDocumentsOpen = False
DTE.Find.FilesOfType = ""
DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResults1
DTE.Find.Action = vsFindAction.vsFindActionReplaceAll
If (DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
Throw New System.Exception("vsFindResultNotFound")
End If
End Sub
End Module