Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 12-15-2016, 07:22 AM
gmayor's Avatar
gmayor gmayor is offline hidden placeholder still prints Windows 10 hidden placeholder still prints Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Create two images - one being they picture you wish to show, the other blank. Then add a bookmark where you want the image to appear, and run the following function to place the picture or the blank image in the bookmark according to the value of the checkbox. If you employ a checkbox content control you can use the CC exit even to check the value of the check box and run the function with the appropriate image for the value of the checkbox. The image will only print if it is actually displayed in the document.

Code:
Public Sub ImageToBM(strBMName As String, strImagePath As String)
'Graham Mayor - http://www.gmayor.com
Dim oRng As Range
Dim fso As Object
    Set fso = CreateObject("Scripting.FileSystemObject")
    If fso.FileExists(strImagePath) Then
        With ActiveDocument
            On Error GoTo lbl_Exit
            Set oRng = .Bookmarks(strBMName).Range
            oRng.Text = ""
            oRng.InlineShapes.AddPicture _
                    FileName:=strImagePath, LinkToFile:=False, _
                    SaveWithDocument:=True
            oRng.End = oRng.End + 1
            oRng.Bookmarks.Add strBMName
        End With
    End If
lbl_Exit:
    Set fso = Nothing
    Set oRng = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
hidden placeholder still prints Table Prints Too Small joebeaven Word 6 02-06-2016 10:44 AM
hidden placeholder still prints VBA to keep hidden rows hidden when filtering tectonicseer Excel Programming 1 07-27-2014 11:54 AM
hidden placeholder still prints Numbering labels prints valeriab Word VBA 8 01-06-2014 06:11 AM
hidden placeholder still prints SlideMaster: Date Placeholder, Footer Placeholder, Slide Number Placeholder? tinfanide PowerPoint 1 04-05-2013 10:37 AM
hidden placeholder still prints Hidden style applied over already-hidden text. christie Word 1 08-17-2011 09:10 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:50 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft