ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Pop up message box? (https://www.excelbanter.com/excel-worksheet-functions/203628-pop-up-message-box.html)

Graciegirl

Pop up message box?
 
Is there a way to create a pop up message in Excel upon opening a workbook?
I want to create something along the lines of "resave this file as xxxx".
--
Gracie

Mike H

Pop up message box?
 
Hi,
Alt+F11 to open vb editor. Double click 'this workbook' and paste this in on
the right. The messagebox dies after 4 seconds if a button isn't pressed.


Private Sub Workbook_Open()
Dim MyBox As Object
Dim Duration As Long
Duration = 4 'Seconds
Msg = "Save workbook as ******"
Ttl = " Your Title"
Set MyBox = CreateObject("WScript.Shell")
response = MyBox.PoPup(Msg, Duration, Ttl, vbOKCancel)
End Sub

Mike
"Graciegirl" wrote:

Is there a way to create a pop up message in Excel upon opening a workbook?
I want to create something along the lines of "resave this file as xxxx".
--
Gracie


Gord Dibben

Pop up message box?
 
Easily done but you might prefer to take the user out of the process and
save the workbook as your new name when you close it?

For the pop-up upon opening...................

Private Sub Workbook_Open()
MsgBox "This file must be re-saved as XXXX"
End Sub

To saveas XXXX.xls when closing...................

Private Sub Workbook_BeforeClose(Cancel As Boolean)
'Note that any existing "XXXX" workbook is overwritten
If ActiveWorkbook.Name = "XXXX.xls" Then Exit Sub
Application.DisplayAlerts = False
ActiveWorkbook.SaveCopyAs Filename:="XXXX.xls"
ActiveWorkbook.Save 'saves original workbook also
Application.DisplayAlerts = True
End Sub

Both of these go into Thisworkbook module.

Right-click on the Excel Icon left of "file" on the worksheet menu bar and
select "View Code"

Paste whichever event you want into that module.


Gord Dibben MS Excel MVP

On Tue, 23 Sep 2008 13:33:01 -0700, Graciegirl
wrote:

Is there a way to create a pop up message in Excel upon opening a workbook?
I want to create something along the lines of "resave this file as xxxx".




All times are GMT +1. The time now is 08:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com