2012-03-21 64 views
6

是否有一些Visual Studio 2008的AddIn或擴展,允許我運行宏直到文件結尾?我真的很討厭按住CTRL + SHIFT + P並等待文件到達結尾。運行宏,直到Visual Studio中的文件結尾

+1

你接受不自由的解決方案? (外部編輯器) – Steve 2012-03-28 14:35:51

+0

我不會與外部編輯...因爲有一堆甚至免費的替代品,支持這一點。那麼Visual Studio 2008絕對不支持運行到文件結尾?!任何人都知道Visual Studio 2010的情況如何? – kape123 2012-03-29 15:57:11

+0

好吧,很高興知道。下面Cristian的回答非常好。 – Steve 2012-03-29 17:46:28

回答

5

你可以錄製宏,然後打開宏IDE(ALT + F11),將預先錄製的宏在這樣的循環:

Sub TemporaryMacro() 
    selection = DTE.ActiveDocument.Selection() 
    anchorPoint = selection.AnchorPoint.CreateEditPoint 
    selection.EndOfDocument(True) 
    endPoint = selection.BottomPoint.CreateEditPoint() 
    selection.MoveToPoint(anchorPoint) 

    Do While True 
     isEOF = DTE.ActiveDocument.Selection.TopPoint.CreateEditPoint().Line = endPoint.Line 
     If (isEOF) Then 
      Exit Do 
     End If 

     ' Prerecorded macro 
     DTE.ActiveDocument.Selection.Text = " " 
     DTE.ActiveDocument.Selection.LineDown() 
     DTE.ActiveDocument.Selection.CharLeft() 
     ' End of prerecorder macro 

    Loop 
End Sub 
+0

謝謝無論如何 - 我不喜歡答案......但似乎沒有比它能做的更好的了。 – kape123 2012-04-08 04:11:35