reading fields 
Author Message
 reading fields

I am trying to read the data in the fields in a document.
This works for most files but if the document is protected I can't read the
fields. Does anyone know how to cycle through the fields collection and read
the data even if the document is protected?
----------------------------------------------------------
'works for non-protected document
For Each objField In objWordDoc.Fields
       strTemp = objField.Result
Next objField

Thanks,

Bill Irish



Fri, 08 Nov 2002 03:00:00 GMT  
 reading fields
Hi Bill,

Quote:
> I am trying to read the data in the fields in a document.
> This works for most files but if the document is protected I can't read
the
> fields. Does anyone know how to cycle through the fields collection and
read
> the data even if the document is protected?

Can you post back with a little more info on what you're doing? What type of
fields are you interested in? Probably no formfields since you can't read
them with the code you posted, but for providing an alternative it would be
good to know what type of fields you need to read?

Regards,
Astrid (Microsoft Word MVP)

For direct access to all Microsoft newsgroups:



Fri, 08 Nov 2002 03:00:00 GMT  
 reading fields
Hi Bill,

I'm sending my answer both to your email address as to the newsgroup. I like
to keep the thread there going so others can contribute or benefit.

Since you say you get an error on your code, I assume that there are more
types of fields inside the document (maybe a datefield perhaps?) When
looping through all the fields inside your documents, this fields are tested
as well. That's why you need either to test for the type of field in your
loop to check if it's a formfield - otherwise you can't use it's result -,
or better and easier, not to loop through the fields collection but through
the formfields collection inside the document.

-------------------------------------------------------
Dim oField As FormField

For Each oField In ActiveDocument.FormFields
  MsgBox oField.Result
Next
-------------------------------------------------------
Hope this helps,
regards,
Astrid (Microsoft Word MVP)

For direct access to all Microsoft newsgroups:

----- Oorspronkelijk bericht -----


Verzonden: maandag 22 mei 2000 23:00
Onderwerp: Re: reading fields

Quote:
> This is just a simple word document with some form fields for the user to
> fill in. The document is protected and I want to cycle through the fields
> and read them.

> Bill

> ----- Original Message -----

> Newsgroups: microsoft.public.word.vba.beginners
> Sent: Monday, May 22, 2000 10:36
> Subject: Re: reading fields

> > Hi Bill,

> > > I am trying to read the data in the fields in a document.
> > > This works for most files but if the document is protected I can't
read
> > the
> > > fields. Does anyone know how to cycle through the fields collection
and
> > read
> > > the data even if the document is protected?

> > Can you post back with a little more info on what you're doing? What
type
> of
> > fields are you interested in? Probably no formfields since you can't
read
> > them with the code you posted, but for providing an alternative it would
> be
> > good to know what type of fields you need to read?

> > Regards,
> > Astrid (Microsoft Word MVP)

> > For direct access to all Microsoft newsgroups:




Sat, 09 Nov 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Read fields before changes

2. Read field name from a table via vba

3. Reading field names of tables through VBA

4. reading Fields

5. Reading field values into variables

6. Reading Fields and Bookmarks in VBA

7. Trouble reading field in database

8. reading fields / giving a variable

9. reading Fields

10. Reading fields from a dbase IV file

11. How to read fields into list boxes?

12. How to read fields into list boxes?

 

 
Powered by phpBB® Forum Software