桃之夭夭分享 http://blog.sciencenet.cn/u/yelloworld

博文

自动设置更改EXCEL的页眉文字

已有 3329 次阅读 2011-11-7 08:39 |个人分类:小程序开发|系统分类:科研笔记| EXCEL, 桌面, Documents, 应收款

Sub Macro1()
'
' Macro1 Macro
'Workbooks.Open Filename:= _
        '"C:Documents and Settingsanmin.fu桌面FX12、长期应收款0.xls"
       
    Dim inbook As String
    'Dim insheet As String
    Dim i As Integer
    'Dim EachSheet As Worksheet
    'Dim outbook As String
    'Dim outsheet1 As String
    'Dim outsheet2 As String
   
    'Create Excel file that as the book name and sheet name
    'specify the input fileslist and out put file and out sheet.
    'outbook = "Tahe-HtSta.xls"
    'outsheet1 = "Tahe-HtSta"
    'outsheet2 = "Tahe-treeNumSta"
    For i = 1 To 306 '需更改数目与filelist中的个数一致
        '指定输入文件book和Sheet
        inbook = Workbooks("filelist.xls").Worksheets("filelist").Cells(i, 1).Value
        inbook1 = Workbooks("filelist.xls").Worksheets("filelist").Cells(i, 2).Value
        Workbooks.Open Filename:=inbook
 '_
        '"C:Documents and Settingsanmin.fu桌面FX" & inbook '指定输入文件的路径+文件名
        For Each EachSheet In ThisWorkbook.Sheets
            'EachSheet.PageSetup.RightFooter = "页脚文字插入当前日期:" & Format(Date, "yyyy年m月d日")
            EachSheet.PageSetup.CenterHeader = ""
            EachSheet.PageSetup.LeftHeader = _
            "&""Times New Roman,Bold Italic""&12ICPAs&""Times New Roman,Regular""" & "&""方正舒体,Bold""中泓应泰会计师事务所"
            EachSheet.PageSetup.RightHeader = ""
        Next EachSheet
        Workbooks(inbook1).Save
        Workbooks(inbook1).Close
    Next i
End Sub


https://blog.sciencenet.cn/blog-219445-505402.html

上一篇:根据参考对照txt文件对栅格数据进行重新编码
下一篇:IDL_Code_根据两个TXT文档的关键字列进行合并
收藏 IP: 60.195.106.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-11-11 02:10

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部