Chinaunix首页 | 论坛 | 博客
  • 博客访问: 533644
  • 博文数量: 40
  • 博客积分: 6020
  • 博客等级: 准将
  • 技术积分: 1711
  • 用 户 组: 普通用户
  • 注册时间: 2005-09-20 18:49
文章分类

全部博文(40)

文章存档

2011年(10)

2010年(13)

2009年(12)

2008年(5)

分类: C/C++

2011-01-04 16:22:00

    其中包括全屏编辑、文件注释、类注释、函数注释四个宏。为了写程序更加方便,可以为这几个常用的宏添加快捷键。

Sub FullScreen()
'DESCRIPTION: 全屏编辑
    ExecuteCommand "ToggleFullScreen"
End Sub

Sub AddHeadDesc()
'DESCRIPTION: 添加一个标准的头文件说明
    ActiveDocument.Selection.StartOfDocument
    DefaultUserName = "mubai"
    Dim FileName
    FileName = ActiveDocument.Name
    ActiveDocument.Selection = "/*******************************************************************" +_
                        vbLF + " 文件名        :" + FileName +_
                        vbLF + " 创建者        :" + DefaultUserName +_
                        vbLF + " 创建时间    :" + CStr(Now) +_
                        vbLF + " 功能描述    :" +_
                        vbLF + "              " +_
                        vbLF + " ******************************************************************/" +_
                        vbLF
    ActiveDocument.Selection.LineUp flase, 3
    ActiveDocument.Selection.EndOfLine
End Sub

Sub AddClassDesc()
'DESCRIPTION: 添加类注释
    Dim ClassName
    ClassName = ActiveDocument.Selection.Text
    ActiveDocument.Selection.StartOfLine
    ActiveDocument.Selection = "/******************************************************************" +_
                        vbLF + " 类名        :" + ClassName +_
                        vbLF + " 创建时间    :" + CStr(Now) +_
                        vbLF + " 功能描述    :" +_
                        vbLF + "              " +_
                        vbLF + " ******************************************************************/" +_
                        vbLF
    ActiveDocument.Selection.LineUp flase, 3
    ActiveDocument.Selection.EndOfLine
End Sub

Sub AddMethodDesc()
'DESCRIPTION: 添加函数注释
    Dim MethodName
    MethodName = ActiveDocument.Selection.Text
    ActiveDocument.Selection.StartOfLine
    ActiveDocument.Selection = "/******************************************************************" +_
                        vbLF + " 函数名        :" + MethodName +_
                        vbLF + " 参数        :" +_
                        vbLF + " 返回值        :" +_
                        vbLF + " 功能描述    :" +_
                        vbLF + "              " +_
                        vbLF + " ******************************************************************/" +_
                        vbLF
    ActiveDocument.Selection.LineUp flase, 5
    ActiveDocument.Selection.EndOfLine
End Sub

阅读(1539) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~