bloodmilksky

Board Regular
Joined
Feb 3, 2016
Messages
202
Hi Guys,

Trying to get the below code running on a new workbook. worked perfectly fine on other one, have entered it in to new workbook and when I open it the code doesnt run. Can anyone help please?

Private Sub Workbook_open()


Msg = "Would You Like To Book Holidy ? " & Application.UserName
Ans = MsgBox(Msg, vbYesNo)
If Ans = vbNo Then
Application.DisplayAlerts = False
ThisWorkbook.Save
Application.DisplayAlerts = True
Application.Quit
End If
If Ans = vbYes Then Range("EMPLOYEE2") = Application.UserName




End Sub
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Simple as it may sound, but have you Saved as a Macro Enabled Workbook and then opened it, Enabled macros, and then saved once more then re opened?
 
Upvote 0
Also, confirm that you posted it in the "ThisWorkbook" module?
 
Upvote 0

Forum statistics

Threads
1,215,525
Messages
6,125,325
Members
449,218
Latest member
Excel Master

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top