Solved

Function Calls not available

Posted on 2001-08-17
5
332 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
ID: 6398928
From what I can tell, CountWindows is not a function in MS Word.
0
 
LVL 6

Accepted Solution

by:
Triskelion earned 50 total points
ID: 6398931
try ActiveDocument.Windows.Count
0
 
LVL 3

Author Comment

by:Bob Scriver
ID: 6399000
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
ID: 6399887
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
ID: 6400497
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

803 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