我设置了一份背景为 8.5 x 11 图像的简历(如果需要,可以将其设置为水印)。现在我想设置它,这样它就不会自动打印背景图像,这样雇主就不必费劲了。在网上查看后,我注意到这可能是必须使用 VBA 和模板设置的东西。任何现场或任何愿意解决这个问题的人都将不胜感激。
几乎我只是希望我的 Word 文档不打印图像或水印,而无需让打印它的人进行任何设置。(不必两者兼而有之)
你真的需要VBA吗?
要在 Word 2010 中禁用背景颜色和图像的打印,只需按照以下步骤操作
点击文件 | 选项
您将获得一个“字选项”对话框。
在显示选项卡下,只需取消选中“打印背景颜色和图像”
不知道为什么,但这似乎可以正常工作。
Public WithEvents appWord As Word.Application
Private Sub Document_Open()
Set appWord = Application
' Not sure if your image is a shape or inlineshape, so...
If ThisDocument.Shapes.Count Then
' First Shape is now visible
ThisDocument.Shapes(1).Visible = msoTrue
ElseIf ThisDocument.InlineShapes.Count Then
' First inlineshpae has medium brightness
ThisDocument.InlineShapes.Item(1).PictureFormat.Brightness = 0.5
End If
End Sub
Private Sub appWord_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)
Dim intResponse As Integer
intResponse = MsgBox("This document contains a background image. " & _
"Would you like to hide it before printing?", vbYesNo, _
"Hide Background Image?")
If intResponse = vbYes Then
hide_images
ElseIf intResponse = vbNo Then
show_images
End If
End Sub
Sub hide_images()
Application.DisplayStatusBar = True
With ActiveWindow
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
.DisplayLeftScrollBar = False
.StyleAreaWidth = CentimetersToPoints(0)
.DisplayVerticalRuler = True
.DisplayRightRuler = False
.DisplayScreenTips = True
With .View
.ShowAnimation = True
.Draft = False
.WrapToWindow = False
.ShowPicturePlaceHolders = False
.ShowFieldCodes = False
.ShowBookmarks = False
.FieldShading = wdFieldShadingWhenSelected
.ShowTabs = False
.ShowSpaces = False
.ShowParagraphs = False
.ShowHyphens = False
.ShowHiddenText = False
.ShowAll = True
.ShowDrawings = True
.ShowObjectAnchors = False
.ShowTextBoundaries = False
.ShowHighlight = True
End With
End With
With Options
.UpdateFieldsAtPrint = False
.UpdateLinksAtPrint = False
.DefaultTray = "Druckereinstellungen verwenden"
.PrintBackground = True
.PrintProperties = False
.PrintFieldCodes = False
.PrintComments = False
.PrintHiddenText = False
.PrintDrawingObjects = False
.PrintDraft = False
.PrintReverse = False
.MapPaperSize = True
End With
With ActiveDocument
.PrintPostScriptOverText = False
.PrintFormsData = False
End With
End Sub
Sub show_images()
With Options
.UpdateFieldsAtPrint = False
.UpdateLinksAtPrint = False
.DefaultTray = "Druckereinstellungen verwenden"
.PrintBackground = True
.PrintProperties = False
.PrintFieldCodes = False
.PrintComments = False
.PrintHiddenText = False
.PrintDrawingObjects = True
.PrintDraft = False
.PrintReverse = False
.MapPaperSize = True
End With
With ActiveDocument
.PrintPostScriptOverText = False
.PrintFormsData = False
End With
End Sub
干杯马丁
我使用以下(简短)过程作为功能区扩展,用于在文档标题中显示/隐藏徽标,以便用户可以在创建打印/pdf 之前进行切换。
Sub ShowHideLogoInHeader
本地错误处理程序(非关键)
On Local Error GoTo ErrHandler
昏暗的形状范围
Dim myStory As ShapeRange
Set myStory = ActiveDocument.StoryRanges(wdFirstPageHeaderStory).ShapeRange
myStory.Visible = Not myStory.Visible
Exit Sub
ErrHandler:debug中报错(单独函数)
ReportError "modRibbon - ToonOfVerbergLogo"
Err.Clear
End Sub