Share via

Range.Font.Hidden question

Anonymous
2017-03-25T16:56:17+00:00

Hello,

Is there a setting somewhere that would affect whether the Range.Font.Hidden = True/False works in a document?

Here is the situation:

On Computer1 running Word 2016 when I run the following code (which I wrote using that computer) it does not hide the Bookmark nor does it hide the row.  It does put in the wording of "This is row 3".  And I save that doc.

When I open the same document on Computer2 on the network (do not run the code, just open the doc), the bookmark is hidden, Row 2 is hidden and the wording "This is row 3" does appear.

Go back to Computer1 change programming to have the Hiddens = False, run the code, there is no change in the appearance in the doc.  Save the doc.  

Open it on Computer2 and the the Bookmark is not hidden,  Row2 is not hidden, and the wording is still there.

The code appears to be working when it is run on Computer1 because if I save the doc after running the code when I open the doc on Computer2 it appears how it should.  Note I do not run the code on Computer2 while conducting this test.  (as a side note:  when I do run the code on Computer2 is does work correctly)

It is just the Computer1 document does not recognize the .Hidden = True 

The code is:

ActiveDocument.Bookmarks("Bookmark1").Range.Font.Hidden = True

Selection.GoTo What:=wdGoToBookmark, Name:="Table1"

    With Selection.Tables(1)

       .Rows(2).Range.Font.Hidden = True

      .Cell(3, 2).Range.Text = "This is row 3"

    End With

I hope that explanation makes sense, sorry it is so wordy.

Thank you in advance for your help.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2017-03-25T21:33:54+00:00

There is a user-level setting that determines whether text whose font has the Hidden property set to True is displayed or not: in File > Options, select Display on the left hand side, then tick or clear the check box 'Hidden text'.

You can set Word not to display hidden text in your macro:

ActiveWindow.View.ShowHiddenText = False

But keep in mind that the user can change this at any moment.

Was this answer helpful?

3 people found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2017-03-25T22:05:40+00:00

    Awesome.  Thank you Hans.  That solved my issue perfectly.

    Was this answer helpful?

    0 comments No comments