Send a "Backspace" to word

counihan3

Active Member
Joined
Mar 9, 2007
Messages
458
I have a macro that I am using to generate word documents. Now I need to send a back space to word due to a spacing issue. I have tried vbback but all I got was a square character in my word doc. Does anyone know of a way around this.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
There was no luck with that. Here is the code I am using if that will help.

Code:
Sub coverletterbuild()
               
        Set oWord = CreateObject("Word.Application")
        If Err Then
            Set oWord = New Word.Application
            WordWasNotRunning = True
        End If
        
        oWord.Visible = True
        oWord.Activate

            Set oDoc = oWord.Documents.Add("C:\TEST COVER.doc")
            oDoc.Bookmarks("Line99").Range.InsertBefore "This is a test!" & vbNewLine
            oDoc.Bookmarks("LineTEST").Range.InsertBefore "1!" & vbNewLine & "TESTT"
            Application.SendKeys "{BS}"

End Sub
 
Upvote 0
Does anyone know if word even recognize the character codes for backspace or delete? I assumed it would since you can use ascii code for special characters but we all know what happens when you assume.
 
Upvote 0
Put this at the bttom of your code and see if it works :

Code:
With oWord.Selection
    .EndKey
    .TypeBackspace
End With
 
Upvote 0
Or change the line it is selecting right now it is not effecting line that i need it to.

I see. I am afraid I am not well versed with the Word Object model . Try recording a Macro in word , place the cursor where you want and see if generates some code which you can hopefully adapt.

Edit:
If you don't get the desired answer from someone here I suggest you post your question in this excellent Word Forum.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top