D
D
I have a procedure that I would like to run in a non-visible instance of
Word. To do this, I believe you cannot use the selection object at all, but
instead have to use ranges. So, I've converted most of the procedure to use
ranges, but there is one part that I'm having trouble with. I use this to
check if a line is blank, if it is, then delete said line, continuing this
check until a non-blank line is found. Anyone have any ideas for how to to
convert this to using ranges? Thanks.
Do
With Selection
.MoveUp unit:=wdLine, Count:=1
.EndKey unit:=wdLine, Extend:=False
.HomeKey unit:=wdLine, Extend:=True
If .Type = wdSelectionIP Then
.Delete
Else
.Collapse direction:=wdCollapseStart
Exit Do
End If
End With
Loop
Word. To do this, I believe you cannot use the selection object at all, but
instead have to use ranges. So, I've converted most of the procedure to use
ranges, but there is one part that I'm having trouble with. I use this to
check if a line is blank, if it is, then delete said line, continuing this
check until a non-blank line is found. Anyone have any ideas for how to to
convert this to using ranges? Thanks.
Do
With Selection
.MoveUp unit:=wdLine, Count:=1
.EndKey unit:=wdLine, Extend:=False
.HomeKey unit:=wdLine, Extend:=True
If .Type = wdSelectionIP Then
.Delete
Else
.Collapse direction:=wdCollapseStart
Exit Do
End If
End With
Loop