Solved

Function Calls not available

Posted on 2001-08-17
5
329 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Always hangs on opening 8 66
Excel 2013 Drop down help with data 3 58
Word - Access 3 49
Office2007 Training Material Required 2 41
Introduction Perhaps more familiar to developers who primarily use VBScript than to developers who tend to work only with Microsoft Office and Visual Basic for Applications (VBA), the Dictionary is a powerful and versatile class, and is useful …
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

920 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

15 Experts available now in Live!

Get 1:1 Help Now