VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Accessing the built-in properties like page numbers, lines, paragraphs, words, and characters in a

by Raj Diwate (4 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 9th March 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Accessing the built-in properties like page numbers, lines, paragraphs, words, and characters in a Word document

Rate Accessing the built-in properties like page numbers, lines, paragraphs, words, and characters in a



' Before running this code please attach microsoft office 9.0 library
' using reference in project menu

' Objects  for automation
Dim wdApp      As Word.Application
Dim docNew     As Word.Document

' variables to display builtin properties
Dim vPages         As Variant
Dim vParas         As Variant
Dim vLines         As Variant
Dim vWords         As Variant
Dim vChars         As Variant

On Error GoTo ERR

'  Setting objects
    Set wdApp = New Word.Application
    Set docNew = wdApp.Documents.Open("c:\faltu\AAREL-MC.A23.doc")
    
    wdApp.ActiveDocument.Repaginate
    
    Debug.Print "Pages   " & wdApp.ActiveDocument.BuiltInDocumentProperties(wdPropertyPages)
    Debug.Print "Paras   " & wdApp.ActiveDocument.BuiltInDocumentProperties(wdPropertyParas)
    Debug.Print "Lines   " & wdApp.ActiveDocument.BuiltInDocumentProperties(wdPropertyLines)
    Debug.Print "Words   " & wdApp.ActiveDocument.BuiltInDocumentProperties(wdPropertyWords)
    Debug.Print "Chars   " & wdApp.ActiveDocument.BuiltInDocumentProperties(wdPropertyCharacters)
    
    'Closing application
    wdApp.Quit (0)
    ' Releasing objects
    Set wdApp = Nothing

ERR:
    wdApp.Quit (0)
    Set wdApp = Nothing
    
End Sub

Download this snippet    Add to My Saved Code

Accessing the built-in properties like page numbers, lines, paragraphs, words, and characters in a Comments

No comments have been posted about Accessing the built-in properties like page numbers, lines, paragraphs, words, and characters in a . Why not be the first to post a comment about Accessing the built-in properties like page numbers, lines, paragraphs, words, and characters in a .

Post your comment

Subject:
Message:
0/1000 characters