REM Description: Send current document as email attachment REM Filename: MailAs.wmc REM Created by: Rich Zuris - 11/24/93 REM This macro supports the MAPI email standard (Microsoft) only REM Modified by Phil Griffin-Allwood - 02/22/99 REM Now gives option of file format for attachment 'Windows APIs DECLARE FUNCTION GetTempFileName LIB "kernel" (bDriveLetter AS WORD, lpszPrefixString AS STRING, uUnique AS WORD, lpszTempFileName AS STRING) As Word DECLARE FUNCTION MAPISendDocuments LIB "mapi.dll" (hwnd AS INTEGER, lpDelim AS STRING, lpPaths AS STRING, lpNames AS STRING, res AS INTEGER) AS Integer 'Can't run if no document open IF GetDocName$() = "" THEN MESSAGE "Please create a new document or open an existing document first." STOP ENDIF 'Get temporary file name and save copy of document 'Hope there's enough disk space on temp drive, etc. lpFileName$ = String$(144, " ") ret% = GetTempFileName(I2W(0), "WSW", I2W(0), lpFileName$) rem FileSaveAsCopy (lpFileName$) BEGIN DIALOG grpdlg 170, 160, "Attachment Type" GROUPBOX 4, 4, 160, 150, "File Export Type:" OPTIONGROUP egroup% PUSHBUTTON 20, 18, 130, 12, "Attach as WSWi&n", 3 PUSHBUTTON 20, 31, 130, 12, "Attach as &WinWord6", 4 PUSHBUTTON 20, 44, 130, 12, "Attach as Word&Star 7.0", 5 PUSHBUTTON 20, 57, 130, 12, "Attach as W&PWin 6.1", 6 PUSHBUTTON 20, 70, 130, 12, "Attach as &AmiPro", 7 PUSHBUTTON 20, 83, 130, 12, "Attach as WordPerfec&t 5.1", 8 PUSHBUTTON 20, 96, 130, 12, "Attach as DOS Text with &Line Breaks", 9 PUSHBUTTON 20, 109, 130, 12, "Attach as DOS Text without &Line Breaks", 10 PUSHBUTTON 20, 122, 130, 12,"Attach as &Rich Text Format", 11 PUSHBUTTON 20, 135, 130, 12, "Attach as &HTML", 12 END DIALOG ret% = DIALOG(grpdlg) IF ret% = 2 THEN STOP IF ret% = 3 THEN GOTO WSWIN IF ret% = 4 THEN GOTO DOC IF ret% = 5 THEN GOTO WS IF ret% = 6 THEN GOTO WPD IF ret% = 7 THEN GOTO SAM IF ret% = 8 THEN GOTO WP5 IF ret% = 9 THEN GOTO WRAPTXT IF ret% = 10 THEN GOTO TXT IF ret% = 11 THEN GOTO RTF IF ret% = 12 THEN GOTO HTML WSWIN: FileSaveAsCopy (lpFileName$) 'Get title of this document from WSWin docName$ = GetDocName$() WHILE INSTR(docName$, "\") docName$ = MID$(docName$, INSTR(docName$, "\") + 1) WEND 'If doc is untitled, name it Untitled (sans number) IF LEFT$(docName$, 8) = "Untitled" THEN docName$ = "Untitled.wsd" END IF GOTO Continue: DOC: FileExport lpFileName$, "Microsoft Word for Windows 6.0-7.0" WSWin$ = INPUTBOX$("Please type in Attachment File Name") docName$ = WSWin$ + ".doc" GOTO Continue: WS: FileExport lpFileName$, "WordStar 7.0" WSWin$ = INPUTBOX$("Please type in Attachment File Name") docName$ = WSWin$ + ".ws" GOTO Continue: WPD: FileExport lpFileName$, "WordPerfect for Windows 6.1" WSWin$ = INPUTBOX$("Please type in Attachment File Name") docName$ = WSWin$ + ".wpd" GOTO Continue: SAM: FileExport lpFileName$, "Ami Pro 2.0, 3.0" WSWin$ = INPUTBOX$("Please type in Attachment File Name") docName$ = WSWin$ + ".sam" GOTO Continue: WP5: FileExport lpFileName$, "WordPerfect 5.1, 5.2" WSWin$ = INPUTBOX$("Please type in Attachment File Name") docName$ = WSWin$ + ".wp5" GOTO Continue: WRAPTXT: FileExport lpFileName$, "DOS Text with Line Breaks" WSWin$ = INPUTBOX$("Please type in Attachment File Name") docName$ = WSWin$ + ".txt" GOTO Continue: TXT: FileExport lpFileName$, "DOS Text without Line Breaks" WSWin$ = INPUTBOX$("Please type in Attachment File Name") docName$ = WSWin$ + ".txt" GOTO Continue: RTF: FileExport lpFileName$, "Microsoft RTF (WinWord 6)" WSWin$ = INPUTBOX$("Please type in Attachment File Name") docName$ = WSWin$ + ".rtf" GOTO Continue: HTML: FileExport lpFileName$, "HTML Level 3 - Netscape" WSWin$ = INPUTBOX$("Please type in Attachment File Name") docName$ = WSWin$ + ".htm" GOTO Continue: Continue: 'Call MAPI UI to send the document ret% = MAPISendDocuments(0, ";", lpFileName$, docName$, 0) 'Delete the temp file KILL lpFileName$ STOP