Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Code to run dialogue box at workbook startup

Howdy,

Can anyone suggest code to run a dialogue box when a workbook opens but
only on the first of every month?

Ta :)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 179
Default Code to run dialogue box at workbook startup

hi
use one buffer cell (Ex AA1 of sheet1)
now see the code below what i mentioned
'below mentioned code you have to paste on your 'thisworkbook' module

Private Sub Workbook_Open()
If Month(Date) < Sheet1.Range("AA1").Value Then
MsgBox "This is the first time you are opening this workbook on this
month"
Sheet1.Range("AA1").Value = Month(Date)
End If
End Sub

please do rate

"Doo0592" wrote:

Howdy,

Can anyone suggest code to run a dialogue box when a workbook opens but
only on the first of every month?

Ta :)


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 179
Default Code to run dialogue box at workbook startup

I think Rafeek has misunderstood you slightly!
try this:

Private Sub Workbook_Open()
If Format(Now(), "DD") = 1 Then
MsgBox "It's the first of the month"
End If
End Sub

If I did misunderstand you, then I apologize for any
inconvenience.

Cheers
Carlo

"Doo0592" wrote:

Howdy,

Can anyone suggest code to run a dialogue box when a workbook opens but
only on the first of every month?

Ta :)


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Code to run dialogue box at workbook startup

Thanks folks.

Not sure I understand your code either Rafeek. I get that you are
trying to reference cell AA1 as the date but it didn't seem to execute
properly when I made the date the first of the month... it did work
when there was no date in AA1 at all thou! lol

Carlo.. I think I understand your code. If Now() calls the system date
for today and "DD" the actual date, if DD= the first of the month then
the msgbox will run. Am I right?
Also, is there a way I can test this without having wait till the
beginning of the month? lol (even thou it is only 2 days away!)

Thanks again all xx
Doo

Carlo wrote:

I think Rafeek has misunderstood you slightly!
try this:

Private Sub Workbook_Open()
If Format(Now(), "DD") = 1 Then
MsgBox "It's the first of the month"
End If
End Sub

If I did misunderstand you, then I apologize for any
inconvenience.

Cheers
Carlo

"Doo0592" wrote:

Howdy,

Can anyone suggest code to run a dialogue box when a workbook opens but
only on the first of every month?

Ta :)



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Code to run dialogue box at workbook startup

Actually Rafeek, I think I understand your code now. If I am right it
will only execute once per month? If I am right, is there a way we can
combine your code with Carlo's. I think it will probably annoy my end
users if this msg box executes every time they open the workbook! lol

ta :)

Doo
Doo0592 wrote:

Thanks folks.

Not sure I understand your code either Rafeek. I get that you are
trying to reference cell AA1 as the date but it didn't seem to execute
properly when I made the date the first of the month... it did work
when there was no date in AA1 at all thou! lol

Carlo.. I think I understand your code. If Now() calls the system date
for today and "DD" the actual date, if DD= the first of the month then
the msgbox will run. Am I right?
Also, is there a way I can test this without having wait till the
beginning of the month? lol (even thou it is only 2 days away!)

Thanks again all xx
Doo

Carlo wrote:

I think Rafeek has misunderstood you slightly!
try this:

Private Sub Workbook_Open()
If Format(Now(), "DD") = 1 Then
MsgBox "It's the first of the month"
End If
End Sub

If I did misunderstand you, then I apologize for any
inconvenience.

Cheers
Carlo

"Doo0592" wrote:

Howdy,

Can anyone suggest code to run a dialogue box when a workbook opens but
only on the first of every month?

Ta :)





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 179
Default Code to run dialogue box at workbook startup

Hi Doo

You're right, now() calls the system date, so,
DD ist the Format for Day.
i.e. format("31.8.2006";"DD") = 31
If you want to test it, just change the one to
the current day.

Ok, let's try to combine those two codes:
(shouldn't be that big a Problem!)
As Rafeek stated, you need a Cell, which you can
alter any time without problems, so take one which
is at the right bottom of your sheet: AA65000 would
be ok i think, or AA1 if you are sure, that this cell
will never be used.
Enter the Date of Yesterday (just needed to be done
once!)

Private Sub Workbook_Open()
If Format(Now(), "DD") = 1 and worksheets("test").range("AA65000") <
format(now(), "DD.MM.YYYY") Then
MsgBox "It's the first of the month and first time you open the
workbook today"
sheet("test").range("AA65000").formular1c1 = format(now),
"DD.MM.YYYY")
End If
End Sub

you have to change the sheetname "test", the dateformat to your preferred
format and the cell to the cell you want to use!

Hope i could help

Cheers Carlo

"Doo0592" wrote:

Actually Rafeek, I think I understand your code now. If I am right it
will only execute once per month? If I am right, is there a way we can
combine your code with Carlo's. I think it will probably annoy my end
users if this msg box executes every time they open the workbook! lol

ta :)

Doo
Doo0592 wrote:

Thanks folks.

Not sure I understand your code either Rafeek. I get that you are
trying to reference cell AA1 as the date but it didn't seem to execute
properly when I made the date the first of the month... it did work
when there was no date in AA1 at all thou! lol

Carlo.. I think I understand your code. If Now() calls the system date
for today and "DD" the actual date, if DD= the first of the month then
the msgbox will run. Am I right?
Also, is there a way I can test this without having wait till the
beginning of the month? lol (even thou it is only 2 days away!)

Thanks again all xx
Doo

Carlo wrote:

I think Rafeek has misunderstood you slightly!
try this:

Private Sub Workbook_Open()
If Format(Now(), "DD") = 1 Then
MsgBox "It's the first of the month"
End If
End Sub

If I did misunderstand you, then I apologize for any
inconvenience.

Cheers
Carlo

"Doo0592" wrote:

Howdy,

Can anyone suggest code to run a dialogue box when a workbook opens but
only on the first of every month?

Ta :)




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Code to run dialogue box at workbook startup

Thanks Carlo :)

Think I have it now x

Carlo wrote:
Hi Doo

You're right, now() calls the system date, so,
DD ist the Format for Day.
i.e. format("31.8.2006";"DD") = 31
If you want to test it, just change the one to
the current day.

Ok, let's try to combine those two codes:
(shouldn't be that big a Problem!)
As Rafeek stated, you need a Cell, which you can
alter any time without problems, so take one which
is at the right bottom of your sheet: AA65000 would
be ok i think, or AA1 if you are sure, that this cell
will never be used.
Enter the Date of Yesterday (just needed to be done
once!)

Private Sub Workbook_Open()
If Format(Now(), "DD") = 1 and worksheets("test").range("AA65000") <
format(now(), "DD.MM.YYYY") Then
MsgBox "It's the first of the month and first time you open the
workbook today"
sheet("test").range("AA65000").formular1c1 = format(now),
"DD.MM.YYYY")
End If
End Sub

you have to change the sheetname "test", the dateformat to your preferred
format and the cell to the cell you want to use!

Hope i could help

Cheers Carlo

"Doo0592" wrote:

Actually Rafeek, I think I understand your code now. If I am right it
will only execute once per month? If I am right, is there a way we can
combine your code with Carlo's. I think it will probably annoy my end
users if this msg box executes every time they open the workbook! lol

ta :)

Doo
Doo0592 wrote:

Thanks folks.

Not sure I understand your code either Rafeek. I get that you are
trying to reference cell AA1 as the date but it didn't seem to execute
properly when I made the date the first of the month... it did work
when there was no date in AA1 at all thou! lol

Carlo.. I think I understand your code. If Now() calls the system date
for today and "DD" the actual date, if DD= the first of the month then
the msgbox will run. Am I right?
Also, is there a way I can test this without having wait till the
beginning of the month? lol (even thou it is only 2 days away!)

Thanks again all xx
Doo

Carlo wrote:

I think Rafeek has misunderstood you slightly!
try this:

Private Sub Workbook_Open()
If Format(Now(), "DD") = 1 Then
MsgBox "It's the first of the month"
End If
End Sub

If I did misunderstand you, then I apologize for any
inconvenience.

Cheers
Carlo

"Doo0592" wrote:

Howdy,

Can anyone suggest code to run a dialogue box when a workbook opens but
only on the first of every month?

Ta :)





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
No Workbook at Startup Paul Martin[_2_] Excel Discussion (Misc queries) 4 July 23rd 08 02:04 AM
code for print dialogue BorisS Excel Programming 2 June 18th 06 12:23 PM
AutoExec Code to Open Template Dialogue on Startup Dermot Excel Programming 2 March 1st 06 01:10 AM
Startup Code in a Workbook BFarrell Excel Programming 3 October 3rd 05 05:29 PM
Need VBA code for "Open Dialogue" box Brent E Excel Discussion (Misc queries) 2 February 8th 05 04:23 AM


All times are GMT +1. The time now is 09:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"