dcsimg
Results 1 to 4 of 4

Thread: [RESOLVED] How to tell whether a word document is blank?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Posts
    74

    Resolved [RESOLVED] How to tell whether a word document is blank?

    In order to find out whether a word document file is blank, I first get a range object that represents the main document story through _Document.Content property, then I get the text in the range through the Range.Text property. Now I can get the length of the text, if the text length is 0, then the word document is a blank file. However, after running the code, the length of the text for a new and blank word file is 1, the range starts at 0, ends at 1, it's very strange, isn't it?

    Who could tell me what is the best way to determine whether a word document is blank? Thank you for your help!

  2. #2
    Frenzied Member
    Join Date
    Jan 2010
    Location
    Connecticut
    Posts
    1,687

    Re: How to tell whether a word document is blank?

    I don't know, but by your post it appears that a blank word document has a length of 1. Try typing a character and/or a carriage return. If you get a length of > 1 then you can use 1 for blank.
    VB6 Library

    If I helped you then please help me and rate my post!
    If you solved your problem, then please mark the post resolved

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Posts
    74

    Re: How to tell whether a word document is blank?

    Thank you for your reply.

    When there is only a symbol of carriage return on a new and blank word document, the text length is 1. When I input a character 'a', then the text length is 2. It seems for a new and blank word document, the text length is 1.

  4. #4
    Frenzied Member
    Join Date
    Jan 2010
    Location
    Connecticut
    Posts
    1,687

    Re: How to tell whether a word document is blank?

    Good you figured it out. PLease mark your thread resolved if you have your answer.
    VB6 Library

    If I helped you then please help me and rate my post!
    If you solved your problem, then please mark the post resolved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width