------------------------------------------------------------------------ A macro that Formats a floppy in A: ------------------------------------------------------------------------ After creating the macro go to Tools Customise and assign the Macro to a menu or toolbar. Word 8 (Word 97) ================ Go to Tools - Macro - Macros and type FormatFloppy then Create. Paste this code in. ----------- Option Explicit Private Declare Function SHFormatDrive Lib "shell32" (ByVal hWnd As Long, ByVal Drive As Long, ByVal FormatID As Long, ByVal Opt As Long) As Long Private Declare Function GetActiveWindow Lib "user32" () As Long Public Sub MAIN() Dim SHFMT_OPT_FULL Dim SHFMT_OPT_SYSONLY Dim SHFMT_ID_DEFAULT Dim hWnd Dim Drive Dim a SHFMT_OPT_FULL = 1 SHFMT_OPT_SYSONLY = 2 SHFMT_ID_DEFAULT = 65535 hWnd = GetActiveWindow Rem A=0, B=1, C=2 Drive = 0 a = SHFormatDrive(hWnd, Drive, SHFMT_ID_DEFAULT, SHFMT_OPT_FULL) If a = -1 Then WordBasic.MsgBox "Error occured on last format. Drive may be formatable." + Chr(10) + "Try again.", "Serenity Floppy Format", 48 If a = -2 Then WordBasic.MsgBox "User cancelled the Format." + Chr(10) + "Press OK to return to Word.", "Serenity Floppy Format", 64 If a = -3 Then WordBasic.MsgBox "Error occured on last format. Drive is not formatable." + Chr(10) + "Insert a new disk and try again.", "Serenity Floppy Format", 48 Rem Here are the error codes (Word 7 makes this hard to decipher). Rem #define SHFMT_ERROR 0xFFFFFFFFL // Error on last format,// drive may be formatable (ie -1) Rem #define SHFMT_CANCEL 0xFFFFFFFEL // Last format wascanceled (ie: -2) Rem #define SHFMT_NOFORMAT 0xFFFFFFFDL // Drive is not formatable (ie -3) End Sub Word 7 (Word 95) ================ Go to Tools - Macro type FormatFloppy then Create. Paste this code in. ----------- Declare Function SHFormatDrive Lib "shell32" (ByVal hWnd As Long, ByVal Drive As Long, ByVal FormatID As Long, ByVal Opt As Long) As Long Declare Function GetActiveWindow Lib "user32" () As Long Public Sub MAIN Dim SHFMT_OPT_FULL Dim SHFMT_OPT_SYSONLY Dim SHFMT_ID_DEFAULT Dim hWnd Dim Drive Dim a SHFMT_OPT_FULL = 1 SHFMT_OPT_SYSONLY = 2 SHFMT_ID_DEFAULT = 65535 hWnd = GetActiveWindow Rem A=0, B=1, C=2 Drive = 0 a = SHFormatDrive(hWnd, Drive, SHFMT_ID_DEFAULT, SHFMT_OPT_FULL) If a = -1 Then MsgBox "Error occured on last format. Drive may be formatable." + Chr(10) + "Try again.", "Serenity Floppy Format", 48 If a = -2 Then MsgBox "User cancelled the Format." + Chr(10) + "Press OK to return to Word.", "Serenity Floppy Format", 64 If a = -3 Then MsgBox "Error occured on last format. Drive is not formatable." + Chr(10) + "Insert a new disk and try again.", "Serenity Floppy Format", 48 Rem Here are the error codes Rem #define SHFMT_ERROR 0xFFFFFFFFL // Error on last format,// drive may be formatable (ie -1) Rem #define SHFMT_CANCEL 0xFFFFFFFEL // Last format wascanceled (ie: -2) Rem #define SHFMT_NOFORMAT 0xFFFFFFFDL // Drive is not formatable (ie -3) End Sub