WorkBook Open Error

bloodmilksky

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

I am using the below upon opening the workbook and have assigned both subs to the Workbook and not sheets.

everytime i open the workbook i get a run time error 1004 saying that either the macros are disabled or the sub isnt available in this workbook.

does anyone know how I could resolve this?

many thanks

jamie



Code:
Private Sub Workbook_Open()


Run "Would_You_Like_To_Place_An_Order"


End Sub


Sub Would_You_Like_To_Place_An_Order()
    Dim myValue As Variant
    
    Msg = "Would You Like To Place An Order ? " & 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 myValue = InputBox("Please enter Account Number Or Postcode")
    Sheets("Menu").Select
    Range("ADDRESSREF") = myValue
End Sub
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
The called sub would normally be in a Standard Module. If it is necessary to keep the called sub in the ThisWorkbook Module, then:
Code:
Application.Run "ThisWorkbook.Would_You_Like_To_Place_An_Order"
 
Upvote 0
Or don't use Run

Code:
Call Would_You_Like_To_Place_An_Order
 
Upvote 0
If what is on sheet2?
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,545
Members
449,089
Latest member
davidcom

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