WD: WordBasic Error #24 Using LoadSavePictures Macro

ID: Q109682

The information in this article applies to:

SYMPTOMS

When you run the LoadSavePictures macro that shipped with Word 2.0c for Windows using Word for Windows versions 6.x, 7.x, you may receive the following WordBasic Error:

   WordBasic error #24, "Bad Parameter."

RESOLUTION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/supportnet/refguide/ 

You can change the LoadSavePictures macro code to correct this problem. To do this, follow these steps:

1. On the Tools menu, click Macro, click to select the LoadSavePictures

   macro in the Macro Name list box, and then click Edit.

2. With your insertion point in the macro editing window, click Find on
   the Edit menu, specify "While loc <> 0" (without the quotation marks) in
   the Find What box, and then click OK.

3. The first found text should be contained in a group of command
   lines as follows:

      While loc <> 0
         nextloc = InStr(loc + 1, a$, "#")
         f$(n) = Mid$(a$, loc + 1, nextloc - loc - 1)
         Print f$(n)
         loc = nextloc
         n = n + 1
      Wend

   Add error trapping statements before and after this set of commands so
   the above lines look like this:

      On Error Resume Next
      While loc <> 0
         nextloc = InStr(loc + 1, a$, "#")
         f$(n) = Mid$(a$, loc + 1, nextloc - loc - 1)
         Print f$(n)
         loc = nextloc
         n = n + 1
      Wend
      On Error Goto ExitRestoreOldPictures

4. Press SHIFT+F4 to locate the next instance of the Find What text.
   This should be:

      While loc <> 0
        nextloc = InStr(loc + 1, a$, "#")
        f$(n) = Mid$(a$, loc + 1, nextloc - loc - 1)
        loc = nextloc
        n = n + 1
      Wend
      InsertField fn$    'reinsert it as a field

   Add error trapping statements before and after this set of commands so
   the above lines look like this:

      On Error Resume Next
      While loc <> 0
         nextloc = InStr(loc + 1, a$, ""#"")
         f$(n) = Mid$(a$, loc + 1, nextloc - loc - 1)
         loc = nextloc
         n = n + 1
      Wend
      On Error Goto ExitRestorePictures

NOTE: Word for Windows versions 6.x and 7.x include a "Save Picture in Document" option in the Insert Picture dialog box that, when not selected, alleviates the problem of large file sizes when you include pictures in documents.

MORE INFORMATION

Microsoft Technical Support created the LoadSavePictures macro to alleviate a problem that occurs when you insert graphics into a large Word 2.x document. In Word 2.x, LoadSavePictures allows you to insert a graphic into a document as a linked field, and then run the LoadSavePictures macro "Compress" option prior to saving the document to reduce the overall file size. After reopening the document, you can then run the LoadSavePictures macro to restore the pictures in the document.

If you use the LoadSavePictures macro in Word for Windows versions 6.x or 7.x to restore previously compressed pictures, you receive a WordBasic error.

Additional query words: error Mid$ LoadSavePictures PSS.DOC

Keywords          : kberrmsg kbmacro kbtool wordnt winword ntword macword word6 word7 word95 
Version           : WINDOWS:6.0,6.0a,6.0c,7.0,7.0a; MACINTOSH:6.0,6.0.1,6.0.1a
Platform          : MACINTOSH WINDOWS
Issue type        : kbprb

Last Reviewed: April 9, 1999