Dear Friends,

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

Thanks and Regards,

Recommended Answers

All 4 Replies

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,

sr = Streamreader

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

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


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.