Display a Msgbox when workbook opens on a specific day specified from Userform data...

chazrab

Well-known Member
Joined
Oct 21, 2006
Messages
917
Office Version
  1. 365
Platform
  1. Windows
I tried to explain as simple and completely in this title.
I have this and it is hard coded in the vb Workbook Open event code window
Code:
If Day(Now) = 8 Then
   MsgBox "See if anyone on MrExcel can help"
Else
End if
All this does is display a predefined Msgbox text string on a predefined day. Ii'd like to be able to
specify the text and date to display from a userform externally, that would
CREATE the code lines for the Msgbox, the text, and the date to display.in the Workbook Open event code window
In other words, do exactly the same thing as above, but Input it from an Input box or userform.

Thanks if anyone can help. Is this asking too much of Excel?

cr
 
Last edited:

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
So your saying you already have a UserForm Open and when you Open another Workbook you want a Message Box to Popup if a Textbox on the Userform specifies a certain date. Is that what you want?

If not be more specific.
 
Upvote 0
So your saying you already have a UserForm Open and when you Open another Workbook you want a Message Box to Popup if a Textbox on the Userform specifies a certain date. Is that what you want?

If not be more specific.

Not exactly. The whole operation is within one workbook. Here is what I did so far:
I created a a sheet called DATA. This sheet accepts values from a userform(MSGINPUT) from a DTPIcker1 value for the date and Textbox1 for the message the MsgBox is to display. The following code is in the Enter button on the userform
Code:
Private Sub CommandButton2_Click()
Dim d As Date
Dim d1 As Date
Dim t As String
Dim s As String
Dim ws As Worksheet
d = Date
d1 = MSGINPUT.DTPicker1.Value
t = ComboBox1.Value
s = MSGINPUT.TextBox1.Value
Sheets("DATA").Select
Set ws = ActiveSheet
For Each cell In ws.Columns(1).Cells
     If IsEmpty(cell) = True Then cell.Select: Exit For
Next cell
ActiveCell.Value = d1
ActiveCell.Offset(0, 1).Value = t
ActiveCell.Offset(0, 2).Value = s
This code just puts the new values from DTPIcker1.value in the first blank cell in col A and Textbox1.value
in col C. Col B is left blank for now until I figure out how to tell Excel to read a time value on that day(d1) and
display the MsgBox with the new textbox1 value on that same day(d1).

In the Worksheet Open event I have
Code:
Dim d As Date
Dim t As String
d = Date
Dim rgFound As Range
Set rgFound = Range("DATES").FIND(What:=d, LookIn:=xlValues)
If rgFound Then
  t = rgFound.Offset(0, 1).Value
  s = rgFound.Offset(0, 2).Value
  MsgBox "Today Is" & "  " & d & "  " & s

All this works great to a point - just displaying the MsgBox when the workbook opens. What I want is
not to display it immediately, but at any later time that same day I specify from the MSGINPUT userform(which hasd a combobox with time values as text.

I hope this is clear. Any help would be greatly appreciated

thx, cr
 
Upvote 0
This is beyond my knowledgebase.
I will continue to monitor this thread to see what I can learn.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,186
Members
452,615
Latest member
bogeys2birdies

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