Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-03-2012, 02:34 PM
Jennifer Murphy's Avatar
Jennifer Murphy Jennifer Murphy is offline Macro recorder and ShowFieldCodes Windows XP Macro recorder and ShowFieldCodes Office 2007
Competent Performer
Macro recorder and ShowFieldCodes
 
Join Date: Aug 2011
Location: Silicon Valley
Posts: 234
Jennifer Murphy is on a distinguished road
Default Macro recorder and ShowFieldCodes

I wanted to write a macro to turn off the ShowFieldCodes setting, which somehow got changed. I used the macro recorder to capture the code for turning it on and off. One macro below turned it on and one turned it off. Oddly, they both have the exact same code. Is this a toggle?



Code:
Sub Macro1()
  ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
End Sub
 
Sub Macro2()
  ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
End Sub
I then did a search on this control and found an MSDN article showing that it takes a boolean argument.

http://tinyurl.com/bxprt6b

So, I added this code to my macro, which seems to work.

Code:
  ActiveWindow.View.ShowFieldCodes = False
My questions is, "Why does the macro recorder return the toggle option rather than the explicit settiong?". It did the same thing for TrackRevisions.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro recorder and ShowFieldCodes Picture properties bug in Word 2010 Macro Recorder ralphpickering Word VBA 5 10-24-2012 10:15 AM
Macro recorder and ShowFieldCodes Stumped by the recorder again Ulodesk Word VBA 6 07-02-2012 09:23 AM
How do I assign a macro to a button when the macro is in my personal workbook? foolios Excel Programming 2 07-27-2011 02:41 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:09 AM.


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