WD97: Macro to Disable Float Over Text Property (157773)



The information in this article applies to:

  • Microsoft Word 97 for Windows

This article was previously published under Q157773

SYMPTOMS

In Microsoft Word 97, when you insert a picture or an object, by default, the picture or object is inserted as floating object. That is, the Float Over Text check box is always enabled.

In addition, if you click to clear the Float Over Text check box, the check box is reset each time you insert a new picture or object. That is, the setting you choose is not retained. You must clear the check box each time you insert an object or picture.

This article provides a sample Visual Basic for Applications macro that opens the InsertPicture or InsertObject dialog box with the Float Over Text check box deselected.

Note: In Microsoft Word 97 Service Release 1, when you insert a picture or object, it is inserted as an inline (non-floating) object. That is, the Float Over Text check box is cleared by default.

In addition, if you click to select the Float Over Text check box, Word will retain your setting. That is, the option will be set until you change it again.

For additional information, please see the following articles in the Microsoft Knowledge Base:

170564 WD97: Pictures and Objects Inserted as Inline by Default in SR-1

WORKAROUND

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 a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site: For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: If you name the following example Visual Basic for Applications macros "InsertPicture" and "InsertObject", Word will run these macros instead of opening the default dialog box when you click From File (On the Insert Picture menu) or when you click Object on the Insert menu. You can use another name and assign the macro(s) to a toolbar button or menu if you want to have access both to Word's built-in dialog box and the one displayed when these macros are run.

Macro workaround for the Insert Picture Dialog Box

   Sub InsertPicture()
      With Dialogs(wdDialogInsertPicture)
         .FloatOverText = False
         .Show
      End With
   End Sub
				

Macro workaround for the Insert Object Dialog Box

   Sub InsertObject()
      ' Turns the float over text option off.
      SendKeys "%{t}"
      ' Displays the Insert Object dialog.
      Dialogs(wdDialogInsertObject).Show
   End Sub
				
For more information about adding a command to a menu, click Contents And Index on the Help menu, click the Index tab in Word Help, type the following text

menus

and then double-click the selected text to go to the "Add a command or other item to a menu" topic. If you are unable to find the information you need, ask the Office Assistant.

MORE INFORMATION

For additional information, please see the following article in the Microsoft Knowledge Base:

181058 OFF98: How to Run Sample Code from Knowledge Base Articles

REFERENCES

For more information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:

163435 VBA: Programming Resources for Visual Basic for Applications


Modification Type:MajorLast Reviewed:6/17/2005
Keywords:kbdtacode kbmacroexample kbprb kbualink97 KB157773