Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21847

[RESOLVED] Delete list in ms Word through Vb 6

$
0
0
How to delete list in ms word through vb 6
i use this code but doesn't work.

Code:

Private Sub Command1_Click()
Dim objWrd As New Word.Application
Dim objDoc As New Word.Document
Dim docPath As String
Dim repPath As String
    docPath = App.Path & "\template\test.doc"
    repPath = App.Path & "\report\~TEST" & Format(Now, "ddMMyyyyhhmmssmss") & ".doc"
   
    'Copy template
    Set objDoc = objWrd.Documents.Open(docPath)
    objDoc.SaveAs repPath
    objDoc.Close
   
    Set objDoc = objWrd.Documents.Open(repPath)
    With objWrd.Selection.Find
        .Text = txtSearch
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        .Execute Replace:=wdReplaceAll
    End With
        objWrd.Selection.TypeBackspace 'i use this to delete the list, but it doesn't work
        objDoc.Save
        objDoc.Close
        objWrd.Quit
       
    Set objDoc = Nothing
    Set objWrd = Nothing
End Sub

hope anyone can help me with this little problem.. Thx

Edit : here's my sample project. I hope someone can help me fix this sample project.
Attached Files

Viewing all articles
Browse latest Browse all 21847

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>