Dear Friends,

Am new to vb.net environment. i need to display the number of lines in word file using vb.net..please can anyone help me with this. any code will be appreciated..

Thanks and Regards,
Jayaprakash

you could use the streamreader.Readline() and you must declare a variable of value Integer. After declaration make a loop until the End Of File is reached, and for each line that read then plus 1 to the value of the counter.

Hope i helped,
Alex

sr = Streamreader
Example:

While (End of File is reached)
sr.Readline()
counter += 1
End While

Will this Work on MsWord..I need to Count The No of Pages and Line in a MsWord File

Hmmm...

dim objWord
dim myDoc
Set objWord = New Word.Application
Set myDoc = objWord.Documents.Add("filename")
msgbox myDoc.BuiltInDocumentProperties("NUMBER OF LINES").Value

If The Above Doesn't Work, It Might Be:

msgbox objWord.BuiltInDocumentProperties("NUMBER OF LINES").Value

Thanks for the Quick response..Will try this and reply you..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.