Link to home
Start Free TrialLog in
Avatar of Bob Scriver
Bob ScriverFlag for United States of America

asked on

Function Calls not available

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
Avatar of Triskelion
Triskelion
Flag of United States of America image

From what I can tell, CountWindows is not a function in MS Word.
ASKER CERTIFIED SOLUTION
Avatar of Triskelion
Triskelion
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bob Scriver

ASKER

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
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
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