Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-14-2017, 03:10 AM
lodi123 lodi123 is offline Toggle button to show and hide image Windows 7 32bit Toggle button to show and hide image Office 2010 32bit
Novice
Toggle button to show and hide image
 
Join Date: Feb 2017
Posts: 10
lodi123 is on a distinguished road
Default Toggle button to show and hide image

Hi guys,

I'm looking for a macro for a toggle button (ShowHide) that will show an image in my document when I click on the button in the custom header and will disappear again when I click on it again.


The image is saved as a building block (Interim) and should be inserted in Table 1 Row 4 cell 2.

I can't get it to work on my own. Thanks a lot!!
Lodi
Reply With Quote
  #2  
Old 03-15-2017, 09:34 PM
gmayor's Avatar
gmayor gmayor is offline Toggle button to show and hide image Windows 10 Toggle button to show and hide image Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,142
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

The following macro will do that

Code:
Sub TogglePicture()
Dim oRng As Range
Dim oShape As InlineShape
    Set oRng = ActiveDocument.Tables(1).Cell(4, 2).Range
    With oRng.InlineShapes(1)
        If .PictureFormat.Brightness = 1 Then
            .PictureFormat.Brightness = 0.5
        Else
            .PictureFormat.Brightness = 1
        End If
    End With
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
Reply

Tags
hide, show, togglebutton



Similar Threads
Thread Thread Starter Forum Replies Last Post
Toggle button to show and hide image option button show/hide group of fields eugzl PowerPoint 2 12-29-2015 12:40 PM
Toggle button to show and hide image Want to show/hide mutiple grouped coloumns in Excel sheet with a button abutahir Excel 4 11-03-2015 01:07 PM
Toggle Button takes focus and thus changes selection NobodysPerfect Word VBA 1 10-11-2014 04:20 AM
Toggle button to show and hide image Toggle Button Squibble Word VBA 2 06-11-2014 05:36 PM
Header must toggle text & color + show count of conditionally formatted cells below Franktoon Excel 3 02-18-2014 02:10 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:21 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