如何将徽标图像集中到Word 2016页脚中?
我想将徽标图像集中在Word 2016文档的页脚中。
基于 word footer image image图像对齐,我可以得到徽标进入页脚,但无法将其居中。
Sub Main()
'Based on https://stackoverflow.com/questions/58257052/word-footer-image-alignment-in-vba
Dim FIRMADOC As String
Dim SHP As InlineShape
Dim rng As Word.Range
FIRMADOC = "C:\Users\" & Environ("username") & "\Documents\Invoice\footer.png"
Set rng = ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range
rng.Collapse wdCollapseStart
rng.Text = vbTab & vbTab 'position at second, right-aligned tab in the footer)
‘(Note: I have tried removing the tabs to no useful effect)
Set SHP = rng.InlineShapes.AddPicture(FileName:=FIRMADOC, LinkToFile:=False, SaveWithDocument:=True, Range:=rng)
'Based on Record Macro
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Application.Templates( _
"C:\Users\Brian\AppData\Roaming\Microsoft\Document Building Blocks\1033\16\Built-In Building Blocks.dotx" _
).BuildingBlockEntries("Bold Numbers 3").Insert Where:=Selection.Range, _
RichText:=True
End Sub
图像(“ FirmAdoc”)结束时是合理的。手动更改家庭标签的对齐工作。记录手动更改空无一人。
I want to center a logo image in the footer of a Word 2016 document.
Based on code from Word footer image alignment in VBA, I can get the logo into the footer but cannot get it centered.
Sub Main()
'Based on https://stackoverflow.com/questions/58257052/word-footer-image-alignment-in-vba
Dim FIRMADOC As String
Dim SHP As InlineShape
Dim rng As Word.Range
FIRMADOC = "C:\Users\" & Environ("username") & "\Documents\Invoice\footer.png"
Set rng = ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range
rng.Collapse wdCollapseStart
rng.Text = vbTab & vbTab 'position at second, right-aligned tab in the footer)
‘(Note: I have tried removing the tabs to no useful effect)
Set SHP = rng.InlineShapes.AddPicture(FileName:=FIRMADOC, LinkToFile:=False, SaveWithDocument:=True, Range:=rng)
'Based on Record Macro
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Application.Templates( _
"C:\Users\Brian\AppData\Roaming\Microsoft\Document Building Blocks\1033\16\Built-In Building Blocks.dotx" _
).BuildingBlockEntries("Bold Numbers 3").Insert Where:=Selection.Range, _
RichText:=True
End Sub
The image ('FIRMADOC') ends up left justified. Manually changing alignment from Home Tab works. Recording that manual change comes up empty.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
例如:
或者,如果您希望将徽标格式化为在线:
For example:
or, if you want the logo formatted as in-line: