|
-
Jun 24th, 2004, 05:13 AM
#1
Thread Starter
Fanatic Member
Delete Whole Line [Resolved]
Hi all im trying to delete a whole line in a document if a element of an array has no value
my code at present just place "46" there due to me using VBKeyDelete, so what do i do to replace the ,marker by completley deleting the line???
VB Code:
'Loop Through the array placing in the address info
For intLoop = 1 To UBound(vntAddress)
'See if the Array elemnt has a value
If Len(vntAddress(intLoop)) Then
objRange.Find.Execute FindText:="<Address Line " & intLoop & ">", Forward:=True, _
replacewith:=vntAddress(intLoop), Replace:=wdReplaceAll
Else
objRange.Find.Execute FindText:="<Address Line " & intLoop & ">", Forward:=True, _
replacewith:=vbKeyDelete, Replace:=wdReplaceAll
End If 'Len(vntAddress(intLoop))
Next 'intloop
Thanks
Last edited by Bombdrop; Jun 24th, 2004 at 06:19 AM.
Useful Links
.Net
#Develop, GhostDoc, CodeKeep , be.PINVOKE, Good Code Snippet Site
Krypton Toolkit, XPCC / XP Common Controls, QSS Windows Forms Components
VB.COM
VB.Classic Help File, MB Controls, MZTools, ADO Stored Procedure Generator add-in,
-
Jun 24th, 2004, 05:45 AM
#2
Replace the line with "" instead of the vbdelete key.
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Jun 24th, 2004, 05:47 AM
#3
Thread Starter
Fanatic Member
thanks mate thought of that just leveas a blank space i wish to physically remove the line if there is no information to place within it.
thanks anyway
Useful Links
.Net
#Develop, GhostDoc, CodeKeep , be.PINVOKE, Good Code Snippet Site
Krypton Toolkit, XPCC / XP Common Controls, QSS Windows Forms Components
VB.COM
VB.Classic Help File, MB Controls, MZTools, ADO Stored Procedure Generator add-in,
-
Jun 24th, 2004, 06:04 AM
#4
once the selection is on the right line, you can use this:
VB Code:
wdApp.Selection.Expand wdLine
wdApp.Selection.Delete Unit:=wdCharacter, Count:=1
I'm not sure if you can replace wdApp.Selection with objRange
-
Jun 24th, 2004, 06:18 AM
#5
Thread Starter
Fanatic Member
Thanks SI great works a treat
VB Code:
'Loop Through the array placing in the address info
For intLoop = 1 To UBound(vntAddress)
'See if the Array elemnt has a value
If Len(vntAddress(intLoop)) Then
objRange.Find.Execute FindText:="<Address Line " & intLoop & ">", Forward:=True, _
replacewith:=vntAddress(intLoop), Replace:=wdReplaceAll
Else
objRange.Find.Execute FindText:="<Address Line " & intLoop & ">", Forward:=True ', _
'replacewith:="", Replace:=wdReplaceAll
objRange.Select
Application.Selection.Expand wdLine
Application.Selection.Delete Unit:=wdCharacter, Count:=1
End If 'Len(vntAddress(intLoop))
Next 'intloop
THANKS!!!!!
Useful Links
.Net
#Develop, GhostDoc, CodeKeep , be.PINVOKE, Good Code Snippet Site
Krypton Toolkit, XPCC / XP Common Controls, QSS Windows Forms Components
VB.COM
VB.Classic Help File, MB Controls, MZTools, ADO Stored Procedure Generator add-in,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|