Cell contents swapping

T

Tim

Hi All

We have a macro that allows the user to swap the text in
two adjacent cells in a table ... works great.
Now we are looking to use formfields rather than plain
text, we have tried to ammend the macro to swap the
formfield but get an error, any suggestions on swappings
formfields, or even better, the entire contents of a cell
whether it be formfield or text or img ?

Thanks for any input

Tim
 
M

Mark Tangard

Tim,

It's a bit of a dance but doable:

Dim t As Table, r As Range
Set t = ActiveDocument.Tables(1)
t.Cell(1, 1).Range.Cut
Set r = t.Cell(1, 2).Range
r.MoveEnd wdCharacter, -1
t.Cell(1, 1).Range.FormattedText = r.FormattedText
t.Cell(1, 2).Range.Paste
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top