The result of Selection.Font.Hidden will be:
true if ALL of the text is formatted as hidden
False if All of the text is formatted as NOT hidden
Undefined if there is a mixture.
Your code does not allow for the last option
Also:
> Selection.GoTo What:=wdGoToBookmark, Name:="Tableofreplacements"
> Selection.Tables(1).Select
These two lines may change the selected table. First you are
selecting a table by a bookmark (presumably) places around it, then
you care changing the selection to be the first table in the document.
You only need one or the other. They may not be the same thing.
> oRng1.Range.Font.Hidden = True
>
[quoted text clipped - 3 lines]
> Selection.Tables(1).Select
> Set oRng1 = Selection.Tables(1)
Here there is the same problem as above and I can't see what these
last three lines are there for anyway!
Hope this helps.
Cheers!
TonyS.
Marceepoo - 24 Mar 2008 15:21 GMT
Thank you. Much appreciated.
marceepoo
> The result of Selection.Font.Hidden will be:
> true if ALL of the text is formatted as hidden
[quoted text clipped - 30 lines]
> Cheers!
> TonyS.
Jean-Guy Marcil - 24 Mar 2008 17:32 GMT
> The result of Selection.Font.Hidden will be:
> true if ALL of the text is formatted as hidden
[quoted text clipped - 12 lines]
> selecting a table by a bookmark (presumably) places around it, then
> you care changing the selection to be the first table in the document.
In fact,
Selection.Tables(1).Select
selects the first table in the Selction, not the document. For that, you need:
ActiveDocument.Tables(1).Select
> You only need one or the other. They may not be the same thing.
>
[quoted text clipped - 8 lines]
> Here there is the same problem as above and I can't see what these
> last three lines are there for anyway!
If all the OP want to do is create a range object, then the code should have
been:
Dim oRng1 As Range
Set oRng1 =
ActiveDocument.Bookmarks("Tableofreplacements").Range.Tables(1).Range
Do not uset he Selection object unless absolutely necessary.
Tony Strazzeri - 24 Mar 2008 22:50 GMT
> In fact,
> Selection.Tables(1).Select
> selects the first table in the Selction, not the document. For that, you need:
> ActiveDocument.Tables(1).Select
Jean-Guy Marcil Of course you are quite correct. My oversight.
> If all the OP want to do is create a range object, then the code should have
> been:
[quoted text clipped - 5 lines]
>
> Do not uset he Selection object unless absolutely necessary.
I agree with this as well. It is usually better to use the range
object I usually don't make a big point about it because it is just
easier sometimes to use the selection object especially when you are
new or are having problems because you can see what is going on.
Cheers!
TonyS.