O
OTWarrior via OfficeKB.com
I have a word document with form fields that the user will enter information
into. This document is protected.
The information the user inputs into this form is also held in another
document, and I have had people "comment" on having to enter information
twice.
So I came up with the idea of importing the data from this other document
into my document. The first problem is actually importing the information
from the document itself:
************************************************
Private Sub cmdImport_Click()
Dim MyFile As String
ActiveDocument.Bookmarks("ImportTest").Select
MyFile = Dir("W:\Test Documents\")
Selection.InsertFile FileName:=MyFile & "test.doc"
End Sub
*************************************************
The above code specifically imports the contents of the file and pastes them
into the document. Whereas I would Ideally want the information to be brought
into a string value for me to manipulate.
The other issue with this code, is this is very specific, and you cannot
choose the file or directory. How would I bring open an explorer dialog box
(like when you press "insert|file...").
the full explaination of what I want to do is to import the first page from
this document, search for certain words (as the author did not use bookmarks
or form fields) and import the certain words into my chosen form fields as
the result value.
Just some help with how to use a dialog box to choose the file, and how to
bring the information in without pasting it onto the document would be very
much appreciated.
(BTW: I cannot use any databases or change the document that I want to import
from)
into. This document is protected.
The information the user inputs into this form is also held in another
document, and I have had people "comment" on having to enter information
twice.
So I came up with the idea of importing the data from this other document
into my document. The first problem is actually importing the information
from the document itself:
************************************************
Private Sub cmdImport_Click()
Dim MyFile As String
ActiveDocument.Bookmarks("ImportTest").Select
MyFile = Dir("W:\Test Documents\")
Selection.InsertFile FileName:=MyFile & "test.doc"
End Sub
*************************************************
The above code specifically imports the contents of the file and pastes them
into the document. Whereas I would Ideally want the information to be brought
into a string value for me to manipulate.
The other issue with this code, is this is very specific, and you cannot
choose the file or directory. How would I bring open an explorer dialog box
(like when you press "insert|file...").
the full explaination of what I want to do is to import the first page from
this document, search for certain words (as the author did not use bookmarks
or form fields) and import the certain words into my chosen form fields as
the result value.
Just some help with how to use a dialog box to choose the file, and how to
bring the information in without pasting it onto the document would be very
much appreciated.
(BTW: I cannot use any databases or change the document that I want to import
from)