Talk About Network

Google





Software > Access External data > Re: Imoorting a...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 5 Topic 10899 of 11376
Post > Topic >>

Re: Imoorting a word do***ent?

by "pietlinden@[EMAIL PROTECTED] " <pietlinden@[EMAIL PROTECTED] > Aug 7, 2008 at 09:27 PM

Here's my attempt at it... I'm close... I just need the end of line
delimiter from the Word table so I can split the lines...

Option Compare Database
Option Explicit

Private Sub Command0_Click()
    Dim appWord As Word.Application
    Dim docWord As Word.Do***ent
    Dim iCounter As Integer
    Dim iRow As Integer, iColumn As Integer
    Dim oRng As Range
    Dim strContents As String
    Dim rsAddr As DAO.Recordset


'Set oRng = ThisDo***ent.Tables(1).Cell(1, 1).Range
'oRng.MoveEnd Unit:=wdCharacter, Count:=-1
    Me.lblProcessing.Visible = True
    Me.Repaint
    DoCmd.Hourglass True

    Set appWord = New Word.Application
    appWord.do***ents.Open "C:\AddressList.doc"
    Set docWord = appWord.ActiveDo***ent

    Set rsAddr = DBEngine(0)(0).OpenRecordset("Addressbook",
dbOpenTable, dbAppendOnly)

    'process individual cells in the table.
    For iRow = 1 To docWord.Tables(1).Rows.Count
        For iColumn = 1 To docWord.Tables(1).Columns.Count
            Set oRng = docWord.Tables(1).Cell(iRow, iColumn).Range
            oRng.MoveEnd unit:=wdCharacter, Count:=-1

            strContents = Trim(oRng.Text)

            If Len(strContents) > 1 Then
                'splitting would be here.
                rsAddr.AddNew
                rsAddr.Fields("Address") = strContents
                rsAddr.Update
            End If
        Next iColumn
    Next iRow

    rsAddr.Close
    appWord.ActiveDo***ent.Close

    Set rsAddr = Nothing
    Set docWord = Nothing
    appWord.Quit
    Set appWord = Nothing

    DoCmd.Hourglass False
    Me.lblProcessing.Visible = False
    Me.Repaint
End Sub
 




 5 Posts in Topic:
Imoorting a word document?
=?Utf-8?B?amVzc2ljYQ==?=   2008-08-06 19:57:01 
Re: Imoorting a word document?
"bhicks11 via Access  2008-08-07 11:23:51 
Re: Imoorting a word document?
"Roger Lord" &l  2008-08-07 20:07:14 
Re: Imoorting a word document?
"Pete D." <p  2008-08-07 20:11:50 
Re: Imoorting a word document?
"pietlinden@[EMAIL P  2008-08-07 21:27:35 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Fri Jan 9 0:13:15 PST 2009.