S
salio via AccessMonster.com
hi, i am using the following code to open up a word file that is saved on my
S drive. I click a button on my form labeled Command2. the file gets opened
but the stuff that i want to add from the word file to the data base doesn't
occur. I am using Access 2002. I got this code off of some site, I am a
beginner at this stuff.
Private Sub Command2_Click()
Dim oApp As Object
Dim oWord As Object
Set oApp = _
CreateObject("Word.Application")
Set oWord = _
oApp.Documents.Open( _
FileName:="S:\aboutacw.doc")
oApp.Visible = True
oApp.Selection.HomeKey _
Unit:=wdStory
oApp.Selection.EndKey _
Unit:=wdLine, Extend:=wdExtend
DoCmd.GoToRecord , , acNewRec
Do Until oApp.Selection.End + 1 >= _
oApp.ActiveDocument.Content.StoryLength
Me.AboutText = oApp.Selection.Text
DoCmd.GoToRecord , , acNewRec
oApp.Selection.MoveDown Unit:=wdLine, _
Count:=1
oApp.Selection.HomeKey _
Unit:=wdLine
oApp.Selection.EndKey _
Unit:=wdLine, Extend:=wdExtend
Loop
Exit_WordDoc:
Me.AboutText = oApp.Selection.Text
DoCmd.GoToRecord , , acNewRec
oApp.ActiveDocument.Close
oApp.Quit
Set oWord = Nothing
Set oApp = Nothing
End Sub
S drive. I click a button on my form labeled Command2. the file gets opened
but the stuff that i want to add from the word file to the data base doesn't
occur. I am using Access 2002. I got this code off of some site, I am a
beginner at this stuff.
Private Sub Command2_Click()
Dim oApp As Object
Dim oWord As Object
Set oApp = _
CreateObject("Word.Application")
Set oWord = _
oApp.Documents.Open( _
FileName:="S:\aboutacw.doc")
oApp.Visible = True
oApp.Selection.HomeKey _
Unit:=wdStory
oApp.Selection.EndKey _
Unit:=wdLine, Extend:=wdExtend
DoCmd.GoToRecord , , acNewRec
Do Until oApp.Selection.End + 1 >= _
oApp.ActiveDocument.Content.StoryLength
Me.AboutText = oApp.Selection.Text
DoCmd.GoToRecord , , acNewRec
oApp.Selection.MoveDown Unit:=wdLine, _
Count:=1
oApp.Selection.HomeKey _
Unit:=wdLine
oApp.Selection.EndKey _
Unit:=wdLine, Extend:=wdExtend
Loop
Exit_WordDoc:
Me.AboutText = oApp.Selection.Text
DoCmd.GoToRecord , , acNewRec
oApp.ActiveDocument.Close
oApp.Quit
Set oWord = Nothing
Set oApp = Nothing
End Sub