|
-
Jul 14th, 2003, 02:42 AM
#1
Thread Starter
Addicted Member
counting charecters and lines in word
Hi
i want to count charecters and lines from a word file
where i'll select the file for which i want to count charecters and lines through vb6
could some one help me pls its urgent
-
Jul 14th, 2003, 03:15 AM
#2
Fanatic Member
VB Code:
Dim appWord As New Word.Application
Dim docWord As New Word.Document
appWord.Documents.Open App.Path & "\new.doc"
Set docWord = appWord.Documents(1)
MsgBox docWord.Content.ComputeStatistics(wdStatisticCharacters)
MsgBox docWord.Content.ComputeStatistics(wdStatisticWords)
MsgBox docWord.Content.ComputeStatistics(wdStatisticLines)
MsgBox docWord.Content.ComputeStatistics(wdStatisticParagraphs)
MsgBox docWord.Content.ComputeStatistics(wdStatisticPages)
docWord.Close (0)
appWord.Quit
Set docWord = Nothing
Set appWord = Nothing
- Use the thread tools to Mark your Thread as Resolved when your question is answered.
- Please Rate my answers if they where helpful.
-
Jul 14th, 2003, 03:24 AM
#3
Thread Starter
Addicted Member
can i open multiple files and take the count of charecters..?
where can i download microsoft word object library 9.0
-
Jul 14th, 2003, 03:27 AM
#4
-= B u g S l a y e r =-
the library cannot be downloaded, neither redistributed
-
Jul 14th, 2003, 03:29 AM
#5
Thread Starter
Addicted Member
but it is giving me an error
and the library is not available into the reference also
how should i do it
-
Jul 14th, 2003, 03:29 AM
#6
-= B u g S l a y e r =-
-
Jul 14th, 2003, 03:32 AM
#7
Thread Starter
Addicted Member
office 97 is already installed on the machine
but still it is giving an error
-
Jul 14th, 2003, 03:35 AM
#8
-= B u g S l a y e r =-
try using late binding
VB Code:
Option Explicit
Public objWord As Object 'instead of Word.Application
Public wd As Object 'instead of Word.Document
Private Sub Command1_Click()
If objWord Is Nothing Then
Set objWord = CreateObject("Word.Application")
Else
Set objWord = GetObject(, "Word.Application")
End If
DoEvents
Set wd = objWord.Documents.Open("c:\Test.doc")
'here u can do stuff with the document
'using the wd object
'adding some text to it
wd.ActiveWindow.Selection.TypeText "ABCDEFGH peet was here ! :-)"
'when finished manipulating the document, u can show it To the user
objWord.Visible = True
'quit word
If Not (wd Is Nothing) Then Set wd = Nothing
If Not (objWord Is Nothing) Then objWord.Application.Quit
If Not (objWord Is Nothing) Then Set objWord = Nothing
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|