Solved

Function Calls not available

Posted on 2001-08-17
5
325 Views
Last Modified: 2008-01-16
I am attempting to close all documents opened in the Window menu and set their Dirty property to false so that when the documents are closed the User doesn't get prompted for saving them.  We do not want them saving the merged .doc's.  

Dim numwin As Integer
Dim i As Integer
numwin = CountWindows()
If numwin <> 0 Then
    i = numwin
    While i <= 1
        WindowList i
        SetDocumentDirty 0
        i = i - 1
    Wend
End If

    Application.Quit

I am getting a Sub or Function not defined for the statement CountWindows()  Are not all the Word functions normally available in VBA for Word?  I get the same message for the WindowList function call.

Bob Scriver
0
Comment
Question by:Bob Scriver
  • 2
  • 2
5 Comments
 
LVL 6

Expert Comment

by:Triskelion
Comment Utility
From what I can tell, CountWindows is not a function in MS Word.
0
 
LVL 6

Accepted Solution

by:
Triskelion earned 50 total points
Comment Utility
try ActiveDocument.Windows.Count
0
 
LVL 3

Author Comment

by:Bob Scriver
Comment Utility
Thank you.  I just found out that the Microsoft Word Developer's Kit book that I was referencing was for Word 6.0 WinWord and not for Word 97 W/VBA. Lots of great function calls but they obviously no longer exist.  The .count property will work just fine.
 

I have written the code and it seems to be working just fine.

Bob Scriver
0
 
LVL 17

Expert Comment

by:calacuccia
Comment Utility
Hi Bob (and triskelion)

Just a little extra info,

IN Word 97 you can still use Wrd 6.0 commands, by preceding the old command by the WordBasic object.

In your case, this would be

numWin = WordBasic.CountWindows
0
 
LVL 3

Author Comment

by:Bob Scriver
Comment Utility
Great.  Thank you for that.  There are a lot of WordBasic functions that seem interesting and I would like to try them.  Now that I realize the VBA formatting I should be able to incorporate both into my macros.  

Like I said before my expertise is with ACCESS and VBA and I was just steered a little off-center by an out-of-date book with Word 97.  

I am still struggling with another issue if you are willing to help.  

I have a template with existing bookmarks on it.  I wish to load a bookmark, caled date1 with todays date upon the opening of a new document from a template.  Then I would like to direct the focus to another bookmark, called lastname.  I want the user to be able to tab into the date1 bookmark and tab through it if the current date is acceptable or overwrite it with another date if they wish.  Could you possible answer this question for me?  I have another question on the board concerning this issue that I would give you the ACCEPTED ANSWER to if you can help me with this problem.

Bob Scriver

0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction It seems that at least a couple of times per month, I answer a question that requires automating Outlook from another Microsoft Office application, usually (although not always) to send one or more email messages.  For example: …
My experience with Windows 10 over a one year period and suggestions for smooth operation
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now