欢迎来到天天文库
浏览记录
ID:35245918
大小:35.00 KB
页数:8页
时间:2019-03-22
《用word宏制作红头文件格式》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、用word宏制作红头文件格式2010-09-2920:53现在把代码贴出来,以后进行说明Subredup()'一键设置红头文件格式'一、定义变量 Dimam,nam,row,nrowAsInteger DimbtAsString DimfsoAsNewFileSystemObject'========================================================================================================================== '二、获得标题信息 Selection.HomeKey
2、Unit:=wdStory WordBasic.SelectSimilarFormatting bt=Selection'============================================================================================================================ '三、获得文件编号 Set自动=fso.OpenTextFile("D:dcf日记发文autonum.txt") am=自动.ReadLine 自动.Close '四、获得编号后,编号按顺序+1
3、,以共下次使用 nam=am+1 Open"D:dcf日记发文autonum.txt"ForOutputAs#1'output是输出到txt中 Print#1,Str(nam) Close#1'============================================================================================================================ '获得本文档的名字,以便以后激活文档用 myname=ActiveDocument.Name'===========
4、================================================================================================================== '五、读取登记本中的列数 Set登记表=fso.OpenTextFile("D:dcf日记发文登记本的列数.txt") row=登记表.ReadLine 登记表.Close'====================================================================================
5、========================================= '六、打开并激活登记本 ChangeFileOpenDirectory"D:dcf日记发文" Documents.OpenFileName:="发文登记表.doc" Windows("发文登记表.doc").Activate'=============================================================================================================================== '七、填
6、写内容 ActiveDocument.Tables(1).Cell(row,6).Range.Text=bt ActiveDocument.Tables(1).Cell(row,6).Range.Text=bt ActiveDocument.Tables(1).Cell(row,2).Range.Text=Str(am) ActiveDocument.Tables(1).Cell(row,1).Range.Text=Str(am) ActiveDocument.Tables(1).Cell(row,5).Range.Text="市政府" ActiveDocument.T
7、ables(1).Cell(row,7).Range.Text="6" ActiveDocument.Tables(1).Cell(row,8).Range.Text="孝城文" ActiveDocument.Tables(1).Cell(row,9).Range.Text="黄永红"'====================================================
此文档下载收益归作者所有