m_in_spain
Board Regular
- Joined
- Sep 28, 2018
- Messages
- 72
- Office Version
- 365
- Platform
- Windows
The continuing saga of getting Excel to update my word document.
After seemingly endless attempts, lots of help from here, I have found the following line of code actually deletes a (bookmarked in Word with same name) row from my word table:
My problem is that it deletes not only the row i have bookmarked (Bookmark is at the first typing space in the row) but also other rows below it, sometimes 2, sometimes 3. In Word i shade fill some lines to denote a different area, the above code seems to delete all lines down to the shade change.
I have tried, what seems obvious to me, i.e. change Rows to Row, and also leaving out .Range, but each time it then doesn't delete anything.
I need each bookmark to delete one row in word only. Any help much appreciated
After seemingly endless attempts, lots of help from here, I have found the following line of code actually deletes a (bookmarked in Word with same name) row from my word table:
Code:
If docWord.Bookmarks.Exists(xlName.Name) Then docWord.Bookmarks(xlName.Name).Range.Rows.Delete
My problem is that it deletes not only the row i have bookmarked (Bookmark is at the first typing space in the row) but also other rows below it, sometimes 2, sometimes 3. In Word i shade fill some lines to denote a different area, the above code seems to delete all lines down to the shade change.
I have tried, what seems obvious to me, i.e. change Rows to Row, and also leaving out .Range, but each time it then doesn't delete anything.
I need each bookmark to delete one row in word only. Any help much appreciated