S
Sol Apache
I have this code which works fine EXCEPT that in Windows Word (not Mac Word)
it gives an error message that the cell does not exist (because there is a
vertically merged cell before it) - the code then works after giving the
error message.
Naturally an error message will alarm users and I do not want this to
happen.
What I want to do as a workaround is to use a bookmark instead, but I cannot
make a working code which selects the bookmark as range. This is the current
working code, selecting a cell as range.
Dim myRg as range
Set myRg = _
ActiveDocument.Tables(2).Cell(Row:=5, Column:=2).Range
With myRg
..Delete
.Text = TxtAlt1Addr1 & Chr(13)
.Style = ("BaseAddress Back")
.Collapse wdCollapseEnd
.Text = TxtAlt1Addr2.Value & Chr(13)
.Style = ("BaseAddress Back")
..Collapse wdCollapseEnd
..Text = TxtAlt1Addr3.Value & Chr(13)
.Style = ("BaseAddress Back")
.Collapse wdCollapseEnd
.Text = "Telephone: +" & TxtAlt1Phone & Chr(13)
.Style = ("DirectLine Back")
.Collapse wdCollapseEnd
.Text = "Direct Line: +" & TxtAlt1Direct.Value & Chr(13)
.Style = ("BaseAddress Back")
..Collapse wdCollapseEnd
.Text = "Facsimile: +" & TxtAlt1Fax.Value & Chr(13)
.Style = ("BaseAddress Back")
..Collapse wdCollapseEnd
.Text = TxtAltemail.Value & Chr(13)
.Style = ("BaseAddress Back")
..Collapse wdCollapseEnd
.Text = TxtAlt1WWW.Value & Chr(13)
.Style = ("BaseAddress Back")
..Collapse wdCollapseEnd
.Text = TxtAltWWW2.Value & Chr(13)
.Style = ("BaseAddress Back")
..Collapse wdCollapseEnd
End With
Would appreciate any help.
Thanks
it gives an error message that the cell does not exist (because there is a
vertically merged cell before it) - the code then works after giving the
error message.
Naturally an error message will alarm users and I do not want this to
happen.
What I want to do as a workaround is to use a bookmark instead, but I cannot
make a working code which selects the bookmark as range. This is the current
working code, selecting a cell as range.
Dim myRg as range
Set myRg = _
ActiveDocument.Tables(2).Cell(Row:=5, Column:=2).Range
With myRg
..Delete
.Text = TxtAlt1Addr1 & Chr(13)
.Style = ("BaseAddress Back")
.Collapse wdCollapseEnd
.Text = TxtAlt1Addr2.Value & Chr(13)
.Style = ("BaseAddress Back")
..Collapse wdCollapseEnd
..Text = TxtAlt1Addr3.Value & Chr(13)
.Style = ("BaseAddress Back")
.Collapse wdCollapseEnd
.Text = "Telephone: +" & TxtAlt1Phone & Chr(13)
.Style = ("DirectLine Back")
.Collapse wdCollapseEnd
.Text = "Direct Line: +" & TxtAlt1Direct.Value & Chr(13)
.Style = ("BaseAddress Back")
..Collapse wdCollapseEnd
.Text = "Facsimile: +" & TxtAlt1Fax.Value & Chr(13)
.Style = ("BaseAddress Back")
..Collapse wdCollapseEnd
.Text = TxtAltemail.Value & Chr(13)
.Style = ("BaseAddress Back")
..Collapse wdCollapseEnd
.Text = TxtAlt1WWW.Value & Chr(13)
.Style = ("BaseAddress Back")
..Collapse wdCollapseEnd
.Text = TxtAltWWW2.Value & Chr(13)
.Style = ("BaseAddress Back")
..Collapse wdCollapseEnd
End With
Would appreciate any help.
Thanks