Wrox Programmer Forums
|
Word VBA Discuss using VBA to program Word.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Word VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 1st, 2011, 10:26 AM
Authorized User
 
Join Date: Oct 2011
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
Post Word is empty

Hi,

Is there vb code to verify if the word document is empty?
 
Old December 2nd, 2011, 06:26 AM
Authorized User
 
Join Date: Oct 2011
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
Post

I found this way:

Code:
Private Function IsEmptyWord() As Boolean
Selection.WholeStory
For Each c In Selection.Characters
If (c <> vbCr And c <> vbTab And c <> vbFormFeed And c <> " ") Then
IsEmptyWord = False
Exit Function
End If
Next
IsEmptyWord = True
End Function





Similar Threads
Thread Thread Starter Forum Replies Last Post
Display Word doc's file path in the title bar but doc title only in Word taskbr item? numov_40 Word VBA 2 May 15th, 2011 04:06 AM
Dot net - Converting word to pdf and pdf to word Manoah Classic ASP Basics 2 July 7th, 2008 10:21 PM
Creating word doc - word behaviour mat41 Classic ASP Professional 2 April 29th, 2007 06:46 PM
Copy word to word doc. in VB vamshi Pro VB 6 1 March 24th, 2004 06:25 PM
Empty page problem when exported to PDF or Ms Word tasbasi Crystal Reports 0 November 12th, 2003 04:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.