472,333 Members | 1,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,333 software developers and data experts.

Using VB .NET to iterate through a Fields Collection within a Microsoft Word Document ?

Hi Guys,

Am wanting to iterate through a set of Mailmerge Fields within a MS-Word
document using VB .NET. Here's a fragment of code that (should) do this!

Dim WordDoc As Word.Document =
Dim Field As Word.Field
Dim C As Integer = 1
While C <= WordDoc.Fields.Count
Field = WordDoc.Fields.Item(C)
C = C + 1
End While

However, I've noticed that not all the fields are picked up, suspect it's
this line that's the problem...

Field = WordDoc.Fields.Item(C)

Although I don't understand why. In the debugger, C runs through as a
sequence, i.e. 1,2,3,4,5,6 etc

'For Each Field In Word.Fields' doesn't seem to work.

Any help appreciated.


Nov 21 '05 #1
0 2781

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: nuve | last post by:
Hi Please help.. What I want to do is to create a web form that once submitted it takes the fields and opens a new instance of a Word Template and...
by: svdh | last post by:
I have posed a question last saturday and have advanced alot in the meantime. But I am still not there Problem is that I try to merging various...
by: Benjamin Piorczig | last post by:
Hello list memebers, I'd like to use a C# Collection with from within Visual Basic 6. I have derived a my ComInterface class from IList and...
by: Robert W. | last post by:
I'm trying to write a utility that will use Reflection to examine any data model I pass it and correctly map out this model into a tree structure. ...
by: GP | last post by:
Is it possible to iterate through all the controls collection and make the textboxes alone as read only.I don't see a readonly property for the...
by: Karel | last post by:
Hi, I have developed a vb.net application to create a mail-merged document by using Automation to word from VB.NET. I added the following...
by: Mikey | last post by:
Sample VB .NET source code to create mailing labels or customized letters using MS Word MailMerge This VB .NET source code will start MS Word and...
by: Aj Blosser | last post by:
Hey guys, I have a question for you, I have a setup where I'm sending files through the POST to a php web page, I read the file contents, put that...
by: Adam Faulkner via DotNetMonster.com | last post by:
I want to create a method within a class that opens a Microsoft Word 2000 Document and has the facility to Create a new word document and then...
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.