Working with Excels Built-in Dialogs
Keywords: Excel Dialogs
; ///////////////////////////////////////////////////////////////////// ; Winbatch OLE - Working with Excel's built-in dialogs ; script assumes you are working with a workbook that is not ; visible, but you might want to perform various tasks like ; moving a worksheet, or emailing the workbook/ ; rather than devising a custom control, or invoking an ; addition WB Extender, like Postie, your just make a call ; to a built-in Dialog ( there are a lot of them ) ; in the example, a blank workbook is created, but ; you could easily change the script to load one of your own ; Stan Littlefield, December 22, 2002 ; ///////////////////////////////////////////////////////////////////// xlDialogSendMail = 189 xlDialogWorkbookCopy = 283 DB = ObjectOpen("Excel.Application") DB.Visible = @FALSE DB.UserControl = @FALSE DB.DisplayAlerts = @FALSE oAPP = DB.Workbooks oXLS = oAPP.add ; for testing message("Testing Excel Dialogs", "I have a workbook, and I want to Move it") oDialog = DB.Dialogs( xlDialogWorkbookCopy ) oDialog.Show() ;must reset the Visible Property DB.Visible = @FALSE message("Testing Excel Dialogs", "Now I want to email it") oDialog = DB.Dialogs( xlDialogSendMail ) oDialog.Show() DB.Visible = @FALSE ObjectClose( oDialog ) ObjectClose( oXLS ) ObjectClose( oAPP ) DB.Quit ObjectClose(DB) BoxShut() Exit