2012-03-21 17 views
6

¿Hay algún complemento o extensión para Visual Studio 2008 que me permita ejecutar Macro hasta el final del archivo? Realmente odio presionar CTRL + SHIFT + P y esperar hasta que se llegue al final del archivo.Ejecutar macro hasta el final del archivo en Visual Studio

+1

¿Acepta soluciones que no son libres? (Editor externo) – Steve

+0

No iría con editores externos ... porque hay un montón de alternativas gratuitas que respaldan esto. Entonces, Visual Studio 2008 definitivamente no admite Ejecutar hasta el final del archivo? ¿Alguien sabe cuál es la situación con Visual Studio 2010? – kape123

+0

Muy bien, es bueno saberlo. Y la respuesta de Cristian aquí abajo, es realmente buena. – Steve

Respuesta

5

Se puede grabar una macro y luego abrir el IDE de macros (Alt + F11) y coloque la macro grabada en un bucle como este:

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

Gracias en cualquier caso, no me gusta la respuesta ... pero parece que no hay nada mejor que eso. – kape123

Cuestiones relacionadas