Solved

Word Basic Error in Word 6

Posted on 1997-12-15
11
518 Views
Last Modified: 2012-08-14
When I try to open a file from the 'shortlist', I get the following messagebox :

WordBasic Error=509
Command not available

After clicking OK this box pops up:

WordBasic Error=504
Window does not exist.

Word then opens the normal template (normal.dot).

How do I activate the shortlist again?

Thanks in advance
0
Comment
Question by:BlueStar
  • 6
  • 5
11 Comments
 
LVL 1

Expert Comment

by:mviertel
ID: 1606130
Hello,

it seems that in your master template (normal.dot) is a macro called AUTOOPEN. It could also be in a local template that is assigned to the document that you try to open.

I have some subsequent questions, before I can give you a definitive answer.
Did you do any macro programming in Word before that happened?
Was that document written by yourself or was it sent to you?

If you select MACROS from the TOOLS menu, you should be able to see if there are any macros defined. If there is an AUTOOPEN or AUTOSTART macro, you might want to have a look into it (you can also sent me the source code if you want). The quickest way would be to simply erase the macro, but this could also damage the original functionality of your template. Therefore it would be better to have a closer look first.

There is of course also the possibility that the document is infected with a macro virus. You might want to consider to run a virus scanner (a new one).

Slan,

Marcus
0
 

Author Comment

by:BlueStar
ID: 1606131
The problem is a bit more complex.
We have Windows 3.1 on the network and every workstation uses this. However, every user has his own normal.dot template to edit.
I already found out about the problem being the normal dot. When I delete it, and Word builds a new normal.dot the problem is gone.
We also installed a few macro's in everyone's normal dot, for example a Macro Virus Protection (ScanProt) and a macro to use the Winfax.
I'll send you the source of AutoOpen asap. Thanks already for the first step towards the solution.

Rik


0
 
LVL 1

Expert Comment

by:mviertel
ID: 1606132
You mentioned ScanProt and WinFax. Both programs do add certain macros into the NORMAL.DOT to enable integration (like buttons in the toolbar etc.). If the macro tries to execute parts of these programs but any part of the macros (or subsequent parts of it) have been removed or deleted, you might end up with WordBasic errrors like you encountered.
0
 

Author Comment

by:BlueStar
ID: 1606133
The ideal solution for this problem would be not having to remove all the normal.dot 's in the system. I'll start by testing which macro is causing the trouble.

0
 

Author Comment

by:BlueStar
ID: 1606134
OK, the problem seems to be the WinFax autoopen macro. Here's she source code :

Also see correction of question : the file is opened but Word opens normal dot as well (opens 2 documents at the same time).


'**********************************************************************
'  PROJECT      : AutoOpen macro for Microsoft Word version 6.0
'  TITLE      : AutoOpen
'  VERSION      : 2.0
'  AUTHOR      : Delrina Corporation
'  MODIFIED      : April 13, 1994
'**********************************************************************
'
' WinFax macros for MSWord 6.0

Dim Shared merge, oldmacname$, templatepath$, wfxSty$

Sub MAIN
' Check version.
wfxinst$ = GetProfileString$("WinFax", "Setup")
If Left$(AppInfo$(2), 1) = "2" Then
      MsgBox "This macro is for Word 6.0 only.", "Macro Installer"
      FileClose 2
      If wfxinst$ "Yes" Then
            AppMinimize
            AppActivate "Delrina WinFax PRO Setup", 1
            MsgBox "An attempt was made to load the Word 6.0 macro" + \
                  " in Word 2.0x.", "Macro Installer"
      End If
End If
If SelInfo(27) Then
      MsgBox "Command not available in a macro window", "Macro Installer"
      Goto bye
End If
DisableInput 1
If Not DocMaximize() Then DocMaximize

Dim dlg As ToolsOptionsView
GetCurValues dlg
dlg.FieldCodes = 0
TableGridlines 0

Redim dlg As ToolsOptionsSave
GetCurValues dlg
GblPrompt = dlg.GlobalDotPrompt
If GblPrompt = 1 Then dlg.GlobalDotPrompt = 0

INSTALLER

Redim dlg As ToolsOptionsSave
GetCurValues dlg
If GblPrompt = 1 Then dlg.GlobalDotPrompt = 1

bye:
DisableInput 0
End Sub

Sub INSTALLER
Dim dlg As FileSummaryInfo
GetCurValues dlg
path$ = dlg.Directory
glbdot$ = dlg.Template

templatepath$ = GetProfileString$("user-dot-path")
If templatepath$ = "" Then
   templatepath$ = GetProfileString$("programdir")
End If
' Check for an existing backslash  - April 5/94
If Right$(Templatepath$,(Len(Templatepath$) + 1) \
      - Len(Templatepath$)) <> "\" Then
      templatepath$ = Templatepath$ + "\"
End If
FileOpen templatepath$ + "NORMAL.DOT"
If Not DocMaximize() Then DocMaximize

test$ = path$ + "\WORD60.DOC"
Activate "WORD60.DOC"

Begin Dialog UserDialog 374, 118, "Word 6.0 Macro Installer"
      Text 9, 8, 309, 13, "This macro will automatically install all of"
      Text 9, 23, 357, 13, "the macros available for use with WinFax PRO."
      CheckBox 29, 42, 312, 16, "Print to WinFax macro (Print2WinFax)", \
            .InstWinFax
      CheckBox 29, 63, 317, 16, "DDE FaxMerge macro (DDEFaxMerge)", \
            .InstFaxMerge
      OKButton 45, 90, 88, 21
      PushButton 237, 90, 88, 21, "Exit Word"
      CancelButton 141, 90, 88, 21
End Dialog
Redim dlg As UserDialog
dlg.InstWinFax = 1
dlg.InstFaxMerge = 1
x = Dialog(dlg)
If x = 0 Then Goto bye

' User selected to exit Word.
If x = 1 Then FileExit 2

If dlg.InstWinFax = 1 Then
      MacroCopy "WORD60.DOC:Print2WinFax", "NORMAL.DOT:Print2WinFax", 1
      oldmacname$ = "WinFax"
      ChkMacros
      Activate "NORMAL.DOT"
      ToolsCustomizeMenus .MenuType = 0, .Position = 16, .Category = 2, \
            .Name = "Print2WinFax", .Menu = "&File", \
            .AddBelow = "&Print...", .MenuText = "&WinFax...", .Add, \
            .Context = 0

      WfxSty$ = "wfxRecipient"
      CpyStyle
      WfxSty$ = "wfxFaxNum"
      CpyStyle

      Activate "WORD60.DOC"
      sty = 1
      MsgBox "WinFax has been added to the File menu.", "Macro Installer"
EndIf

If dlg.InstFaxMerge = 1 Then
      MacroCopy "WORD60.DOC:DDEFaxMerge", "NORMAL.DOT:DDEFaxMerge", 1
      oldmacname$ = "DDEWinFax"
      ChkMacros
      MsgBox "FaxMerge macro installed.", "Macro Installer"
      Begin Dialog UserDialog 436, 200, "WinFax Send Log keys"
            GroupBox 262, 12, 157, 154, "Select Style Keys"
            CheckBox 282, 27, 101, 16, "&Recipient", .Recipient
            CheckBox 282, 44, 119, 16, "&Fax Number", .FaxNum
            CheckBox 282, 61, 65, 16, "&Date", .fDate
            CheckBox 282, 78, 65, 16, "&Time", .fTime
            CheckBox 282, 95, 97, 16, "&Company", .Company
            CheckBox 282, 112, 87, 16, "&Subject", .Subject
            CheckBox 282, 129, 101, 16, "&Keywords", .Keyword
            CheckBox 282, 146, 117, 16, "&Billing code", .Billcode
            Text 10, 18, 205, 13, "The DDE Fax Merge macro"
            Text 10, 33, 227, 13, "allows for a merged document"
            Text 10, 48, 207, 13, "to be faxed to the intended"
            Text 10, 63, 204, 13, "recipients through WinFax."
            Text 10, 82, 221, 13, "The style keys represent the "
            Text 10, 97, 228, 13, "information which can be sent"
            Text 10, 112, 229, 13, "to the WinFax Send Log when"
            Text 10, 127, 127, 13, "using the macro."
            OKButton 118, 173, 88, 21
            CancelButton 218, 173, 88, 21
      End Dialog
      Redim dlg As UserDialog
      If sty = 1 Then
            dlg.Recipient = 1
            dlg.Recipient = - 1
            dlg.FaxNum = 1
            dlg.FaxNum = - 1
      EndIf
      x = Dialog(dlg)
      If sty <> 1  Then
            Activate "NORMAL.DOT"
            ' These two keys will be installed by default, selected or not.
            WfxSty$ = "wfxRecipient"
            CpyStyle
            WfxSty$ = "wfxFaxNum"
            CpyStyle
            Activate "WORD60.DOC"
      End If
      If x = 0 Then Goto bye
      Activate "NORMAL.DOT"
      If dlg.fDate = 1 Then
            WfxSty$ = "wfxDate"
            CpyStyle
      End If
      If dlg.fTime = 1 Then
            WfxSty$ = "wfxTime"
            CpyStyle
      End If
      If dlg.Company =  1 Then
            WfxSty$ = "wfxTime"
            CpyStyle
      End If
      If dlg.Company =  1 Then
            WfxSty$ = "wfxCompany"
            CpyStyle
      End If
      If dlg.Subject =  1 Then
            WfxSty$ = "wfxSubject"
            CpyStyle
      End If
      If dlg.Keyword = 1 Then
            WfxSty$ = "wfxKeyword"
            CpyStyle
      End If
      If dlg.Billcode = 1 Then
            WfxSty$ = "wfxBillcode"
            CpyStyle
      End If
      Activate "WORD60.DOC"
EndIf
bye:
' Activate and close global template, save all changes
Activate "NORMAL.DOT"
FileClose 1
End Sub

Sub ChkMacros
Loop:
z = CountMacros(0)
Redim GlobalMacros$(z - 1)
For x = 1 To z
      GlobalMacros$(x - 1) = MacroName$(x)

      ' Rename any previous macro from old version.
      If MacroName$(x) = oldmacname$ Then
            Beep
            Organizer .Rename, .Source = templatepath$ + "\NORMAL.DOT", \
                  .Name = oldmacname$, .NewName = "Old" + MacroName$(x), \
                  .Tab = 3
            MsgBox "An older " + oldmacname$ + " macro has been found" + \
                  " and renamed.", "Macro Installer"
            Goto Loop
      End If
Next
End Sub


Sub CpyStyle
FormatStyle .Name = wfxSty$, .BasedOn = "Normal", .NextStyle = "", .AddToTemplate = 0, \
.Define
End Sub

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Expert Comment

by:mviertel
ID: 1606135
Right, what you might want to do is isolate the problem now. If it is this macro, you should be able to enable tracing. That will allow you to step through the macro line by line. Unfortunately WordBasic does not return line number of faulty code. So the only way to eleminate it, is to trace through each macro line.

But, if this appears to you to cumbersome, maybe you'd like to consider to reinstall WinFax on that machine. Make sure tough, that you delete the WinFax macros from Word first. To me it looks like, that this will solve the problem.
0
 

Author Comment

by:BlueStar
ID: 1606136
(Question temporarily reopened for Macro experts.)
0
 
LVL 1

Expert Comment

by:mviertel
ID: 1606137
I doubt that this will get you anywhere. I have written applications in WordBasic and the errors that you mentioned in the initial question indicate, that the Macro is missing a command and after that a window. The missing command can be also a missing macro that is called as subprocedure in the AutoOpen macro. I suppose it opens a window which is then addressed by the AutoOpen macro. Since the first command didn't execute, the second won't either. That is all I can state with the provided information. I suggest, before you fry your brain trying to debug the faulty line, you attempt a reinstall of the WinFax macros as I suggested. If one of the submacros is missing, you can wait till Christmas next year and you still won't get it going again.
(Unless you compare the existing macros from the faulty NORMAL.DOT with the NORMAL.DOT of a system that is working fine).

Marcus Viertel
0
 

Author Comment

by:BlueStar
ID: 1606138
Good enough. I've deleted the AutoOpen macro that was causing the problems. It seems to be some macro that the installer left there by error.
Everything works fine without the macro(incl. the Winfax and Virusscan).

Thanks Marcus.

Rik



0
 
LVL 1

Accepted Solution

by:
mviertel earned 20 total points
ID: 1606139
If the installation was anyhow aborted, e.g. somebody canceled it or somebody reattempted the installation without completing the installation, it could be this.
However, I still think that if you compare the NORMAL.DOT's of two systems, you might see it clearer.

Marcus
0
 

Author Comment

by:BlueStar
ID: 1606140
Case closed.

I'll compare the templates when I have time to spare.

Thanks for the support.

Rik Geerts

0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Problem: You created a new custom form in Outlook for your contacts (added fields, deleted fields, changed the layout of fields, whatever) and made it the default form for contacts. The good news is that all new contacts will utilize the new form. T…
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

759 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

20 Experts available now in Live!

Get 1:1 Help Now