如何将文字FILE NAME
,PAGE NAME
,PAGE OF PAGES
更改为自动代码,当我使用&F
作为文件名时,我会获得路由并且一切都搞砸了。< / p>
它在Excel中:
Sub Podnozje()
'
' Podnozje Makro
'
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = ""
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = "&""Arial,Standard""&10Ersteller: CUTC HR"
.CenterFooter = "&""Arial,Standard""&10FILE NAME" & Chr(10) & "PAGE NAME" & Chr(10) & "PAGE OF PAGES"
.RightFooter = "&""Arial,Standard""&10Druckdatum: &Date"
End With
Application.PrintCommunication = True
End Sub
答案 0 :(得分:0)
在新工作簿中使用以下代码
Option Explicit
Public Sub GenerateFooters()
With ActiveSheet.PageSetup
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = "" 'sometimes I had issues without clearing the footer first
.LeftFooter = "&""Arial,Standard""&10 Ersteller: CUTC HR"
.CenterFooter = "&""Arial,Standard""&10 &F" & Chr(10) & "&A" & Chr(10) & "Seite &P von &N"
.RightFooter = "&""Arial,Standard""&10 Druckdatum: &D"
End With
End Sub
结果
这些是有效代码:
&P
- 当前页码。&N
- 总页数。&B
- 使用粗体*。&I
- 使用斜体字体*。&U
- 使用下划线字体*。&&
- &#39;&amp;&#39;字符。&D
- 当前日期。&T
- 当前时间。&F
- 工作簿名称。&A
- 工作表名称。&"FontName"
- 使用指定的字体名称。&N
- 使用指定的字体大小。