Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-09-2014, 12:33 PM
Jey10 Jey10 is offline Word 2013 Display image by click Windows 7 64bit Word 2013 Display image by click Office 2013
Novice
Word 2013 Display image by click
 
Join Date: Jul 2014
Location: France
Posts: 10
Jey10 is on a distinguished road
Default Word 2013 Display image by click

Hi,



I want to display some images just by clicking on text and this image will be hidden if I click again. Is there a way to do that?
I don't know if it's clear.

Regards,
Reply With Quote
  #2  
Old 07-09-2014, 10:04 PM
macropod's Avatar
macropod macropod is offline Word 2013 Display image by click Windows 7 32bit Word 2013 Display image by click Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You could do this using floating shapes, combined with a MACROBUTTON field coded along the lines of:
{MACROBUTTON ShowHide Text_to_be_clicked}
and a macro like:
Code:
Sub ShowHide()
With ActiveDocument.Shapes(1)
  .Visible = Not .Visible
End With
End Sub
where Text_to_be_clicked is the text you want to make clickable.

Note: The field brace pairs (i.e. '{ }') for the above example are created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 07-10-2014, 10:30 AM
Jey10 Jey10 is offline Word 2013 Display image by click Windows 7 64bit Word 2013 Display image by click Office 2013
Novice
Word 2013 Display image by click
 
Join Date: Jul 2014
Location: France
Posts: 10
Jey10 is on a distinguished road
Default

Thank you for your help.
I never did a macro before, and I just succeed in create it. I did "create a macro" that I named "ShowHide" and I put the code you told me. But I don't know what doing after. Where Do I have to put my text which will display the image by a click? How can I do to put the image I want to display? Furthermore, when I try to save, it says me that I can't save a VBA project in a file without macro.

Regards,
Reply With Quote
  #4  
Old 07-10-2014, 03:42 PM
macropod's Avatar
macropod macropod is offline Word 2013 Display image by click Windows 7 32bit Word 2013 Display image by click Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm.

To create the MACROBUTTON field, select the text that is to be clicked and press Ctrl-F9 to enclose it in a pair of field braces, thus {Text_to_be_clicked}. Then fill in the rest of the field code, so you end up with {MACROBUTTON ShowHide Text_to_be_clicked}. Once you've done that, press F9 to update the field.

For the picture, simply insert it anywhere into the document and make sure it's format is not set to 'in line with text'. Done.

Now, any time you double-click on the 'Text_to_be_clicked' that will toggle the image's display on/off.

As for the saving issue, you'll need to save the document as either a macro-enabled document (.docm format) or in the older .doc format.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 07-11-2014, 09:03 AM
Jey10 Jey10 is offline Word 2013 Display image by click Windows 7 64bit Word 2013 Display image by click Office 2013
Novice
Word 2013 Display image by click
 
Join Date: Jul 2014
Location: France
Posts: 10
Jey10 is on a distinguished road
Default

Thanks again.
I read the link you gave me.
But I'm still blocked :/
I did this : To create the MACROBUTTON field, select the text that is to be clicked and press Ctrl-F9 to enclose it in a pair of field braces, thus {Text_to_be_clicked}. Then fill in the rest of the field code, so you end up with {MACROBUTTON ShowHide Text_to_be_clicked}. Once you've done that, press F9 to update the field.
I had "Afficher" and I did ctrl+f9 and put {MACROBUTTON ShowHide Afficher} and did f9.
My macro is ShowHide and is :
Sub ShowHide()
With ActiveDocument.Shapes(1)
.Visible = Not .Visible
End With
End Sub

I would like to know how link this macro with a specific picture (because I want to do other similar macros for other pictures).
And I want the picture to be hidden at the beginning.

Thanks,

Regards,
Reply With Quote
  #6  
Old 07-11-2014, 04:41 PM
macropod's Avatar
macropod macropod is offline Word 2013 Display image by click Windows 7 32bit Word 2013 Display image by click Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

See attached. Double-clicking anywhere in 'Nunc viverra imperdiet enim' in the 2nd para toggles the image.

The code is written to toggle the first image in the document. If you want multiple images, controlled by multiple MACROBUTTON fields, you'll need a different Sub name for each (e.g. ShowHide1, ShowHide2, etc), referenced in the corresponding MACROBUTTON field, with the macro code referencing the applicable image # (e.g. Shapes(1), Shapes(2), etc.)

Note that the image #s are determined according to their anchor positions in the document, not their placement on the page.
Attached Files
File Type: doc TogglePic.doc (72.0 KB, 109 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 07-12-2014, 05:51 AM
Jey10 Jey10 is offline Word 2013 Display image by click Windows 7 64bit Word 2013 Display image by click Office 2013
Novice
Word 2013 Display image by click
 
Join Date: Jul 2014
Location: France
Posts: 10
Jey10 is on a distinguished road
Default

Ok I want exactly the same thing that in your document.
I attach mine, can you say me why it doesn't work please?

Thanks,
Attached Files
File Type: doc test_macro.doc (182.0 KB, 32 views)
Reply With Quote
  #8  
Old 07-13-2014, 07:07 AM
macropod's Avatar
macropod macropod is offline Word 2013 Display image by click Windows 7 32bit Word 2013 Display image by click Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The only thing 'wrong' with your document is that you haven't added the macro to it.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 07-13-2014, 10:01 AM
Jey10 Jey10 is offline Word 2013 Display image by click Windows 7 64bit Word 2013 Display image by click Office 2013
Novice
Word 2013 Display image by click
 
Join Date: Jul 2014
Location: France
Posts: 10
Jey10 is on a distinguished road
Default

Ok I failed ...
I think this time there is a macro in the document.

If there isn't the macro again, I can say you that I Have a macro ShowHide :
Sub ShowHide()
With ActiveDocument.Shapes(1)
.Visible = Not .Visible
End With
End Sub

And I have this : {MACROBUTTON ShowHide AFFICHER}, the picture isn't inline.

Thanks again, sorry I'm a noob with macro.
Attached Files
File Type: doc Test.doc (113.8 KB, 27 views)
Reply With Quote
  #10  
Old 07-13-2014, 12:15 PM
Jey10 Jey10 is offline Word 2013 Display image by click Windows 7 64bit Word 2013 Display image by click Office 2013
Novice
Word 2013 Display image by click
 
Join Date: Jul 2014
Location: France
Posts: 10
Jey10 is on a distinguished road
Default

Ok I've found that it works.
The problem is that I put a "cover page" and this is it that is hidden.
How can I do to make disappear the second image and not the "cover page"?
Reply With Quote
  #11  
Old 07-13-2014, 03:08 PM
macropod's Avatar
macropod macropod is offline Word 2013 Display image by click Windows 7 32bit Word 2013 Display image by click Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

As indicated in post #6, the image #s are determined according to their anchor positions in the document, not their placement on the page. Since the image on the cover page is, presumably, image #1, try changing .Shapes(1) to .Shapes(2) in the macro.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #12  
Old 07-14-2014, 09:54 AM
Jey10 Jey10 is offline Word 2013 Display image by click Windows 7 64bit Word 2013 Display image by click Office 2013
Novice
Word 2013 Display image by click
 
Join Date: Jul 2014
Location: France
Posts: 10
Jey10 is on a distinguished road
Default

Ok thank you very much
I would like to know 2 last things :
-How can I make move the text when I show or hide the picture? I've put the text after the picture and when I hide the picture, the texte doesn't move.
-Is it possible to hide the pictures when I open the document? When I open, I want the pictures to be hidden, and I show if I want.

Thank you again.

Regards,
Reply With Quote
  #13  
Old 07-14-2014, 08:12 PM
macropod's Avatar
macropod macropod is offline Word 2013 Display image by click Windows 7 32bit Word 2013 Display image by click Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

With your existing image, the 'top & bottom' wrap format means the text should move out of the way when the image is displayed.

If you save the document with the images invisible, they should still be that way when the document is re-opened. The document will always open with the same images visible/invisible as when it was last saved.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #14  
Old 07-15-2014, 07:41 AM
Jey10 Jey10 is offline Word 2013 Display image by click Windows 7 64bit Word 2013 Display image by click Office 2013
Novice
Word 2013 Display image by click
 
Join Date: Jul 2014
Location: France
Posts: 10
Jey10 is on a distinguished road
Default

Ok thanks it works like I want
I think we can say it's resolved.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2013 Display image by click 1.image in a table 2.right click 3.menu click format 4.a format column appears OldFatDog Drawing and Graphics 1 06-13-2014 11:19 PM
Word 2013 Page Display ebbieday Word 1 04-08-2014 09:24 AM
Need: User to click image and leave red dots or circles nursenerd Word VBA 6 03-16-2014 02:41 PM
Call for votes: office 2013 Autocorrect & right click (context menu) franklekens Word 0 09-20-2013 12:09 AM
Display the properties of an embedded image tmazzotta PowerPoint 0 02-18-2011 05:41 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:41 AM.


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