繁体   English   中英

在Visual Studio中运行宏直到文件末尾

[英]Run macro until the end of the file in Visual Studio

Visual Studio 2008是否有一些AddIn或扩展,允许我运行宏直到文件结束? 我真的很讨厌按住CTRL + SHIFT + P并等到文件结束。

您可以录制宏,然后打开宏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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM