Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete leading tab inserts a space

Status
Not open for further replies.
Oct 5, 1999
105
GB
I have written a Word macro, part of which checks all the paragraphs in my document, and then if the first character is a tab it deletes that tab.

The problem is that if the next character is a smart quote or smart apostrophe then Word is automatically inserting a space when I delete the tab. Normal quotes and apostrophes work ok.

i.e. a paragraph containing
(tab)'xxx
when I delete the tab gives
'xxx
as required

but if the paragraph contains then
(tab)(smart open apostrophe)xxx
when I delete the tab becomes
(space)(smart open apostrophe)xxx

Smart quotes give the same problem.

The code I am using (much simplified but still giving the same problem) is:
Code:
Sub DelTab()
Dim intI As Integer

    For intI = 1 To ActiveDocument.Paragraphs.Count
        If ActiveDocument.Paragraphs(intI).Range.Characters(1).Text = vbTab Then
            ActiveDocument.Paragraphs(intI).Range.Characters(1).Delete
        End If
    Next
    
End Sub

Any ideas on how to stop Word doing this?
 
Try clicking
Tools=>Options=>Edit

uncheck "Cut and Paste with space adjustment" (not sure about the exact wording as my word's not English)

Cheers,
MiS

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Thanks - thats great.

Its called "Use smart cut and paste" in Word 2000

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top