ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   macro to display message,when open workbook (https://www.excelbanter.com/excel-discussion-misc-queries/245315-macro-display-message-when-open-workbook.html)

puiuluipui

macro to display message,when open workbook
 
Hi, i need a macro to display a message, first time i open workbook in new
month. If today is 01.11.2009, and i open my workbook, then, the macro to
display message "first day of the month,please save".
Sometime the first day of the month can be sunday, and i will open my
workbook, on the second day of the month, or another day. Can this macro be
made to display the message first time i open workbook in the new month?
Can this be done?
Thanks!

Jacob Skaria

macro to display message,when open workbook
 
Use the Workbook Open event.....and try the below code

Private Sub Workbook_Open()
If Format(FileDateTime(Me.FullName), "mmyy") < _
Format(Date, "mmyy") Then MsgBox "first day of the month,please save"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i need a macro to display a message, first time i open workbook in new
month. If today is 01.11.2009, and i open my workbook, then, the macro to
display message "first day of the month,please save".
Sometime the first day of the month can be sunday, and i will open my
workbook, on the second day of the month, or another day. Can this macro be
made to display the message first time i open workbook in the new month?
Can this be done?
Thanks!


puiuluipui

macro to display message,when open workbook
 
Can you help me a little bit with how to use the Workbook Open event?
Thanks!

"Jacob Skaria" a scris:

Use the Workbook Open event.....and try the below code

Private Sub Workbook_Open()
If Format(FileDateTime(Me.FullName), "mmyy") < _
Format(Date, "mmyy") Then MsgBox "first day of the month,please save"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i need a macro to display a message, first time i open workbook in new
month. If today is 01.11.2009, and i open my workbook, then, the macro to
display message "first day of the month,please save".
Sometime the first day of the month can be sunday, and i will open my
workbook, on the second day of the month, or another day. Can this macro be
made to display the message first time i open workbook in the new month?
Can this be done?
Thanks!


Jacob Skaria

macro to display message,when open workbook
 
Here we go. From workbook press Alt+F11 to launch VBE (Visual Basic Editor).
From the left treeview search for the workbook name and click on + to expand
it. Within that you should see the following

VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
This Workbook

Double click 'This WorkBook' and paste the below code to the right code pane.

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Can you help me a little bit with how to use the Workbook Open event?
Thanks!

"Jacob Skaria" a scris:

Use the Workbook Open event.....and try the below code

Private Sub Workbook_Open()
If Format(FileDateTime(Me.FullName), "mmyy") < _
Format(Date, "mmyy") Then MsgBox "first day of the month,please save"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i need a macro to display a message, first time i open workbook in new
month. If today is 01.11.2009, and i open my workbook, then, the macro to
display message "first day of the month,please save".
Sometime the first day of the month can be sunday, and i will open my
workbook, on the second day of the month, or another day. Can this macro be
made to display the message first time i open workbook in the new month?
Can this be done?
Thanks!


puiuluipui

macro to display message,when open workbook
 
Hi Jacob, i paste the code into this workbook. i saved and closed everything.
i opened the workbook, but the macro didn't displayed any message. i closed
the workbook, set the time to 01.10.2009, and open again. nothing. what am i
doing wrong?
Thanks!

"Jacob Skaria" a scris:

Here we go. From workbook press Alt+F11 to launch VBE (Visual Basic Editor).
From the left treeview search for the workbook name and click on + to expand
it. Within that you should see the following

VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
This Workbook

Double click 'This WorkBook' and paste the below code to the right code pane.

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Can you help me a little bit with how to use the Workbook Open event?
Thanks!

"Jacob Skaria" a scris:

Use the Workbook Open event.....and try the below code

Private Sub Workbook_Open()
If Format(FileDateTime(Me.FullName), "mmyy") < _
Format(Date, "mmyy") Then MsgBox "first day of the month,please save"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i need a macro to display a message, first time i open workbook in new
month. If today is 01.11.2009, and i open my workbook, then, the macro to
display message "first day of the month,please save".
Sometime the first day of the month can be sunday, and i will open my
workbook, on the second day of the month, or another day. Can this macro be
made to display the message first time i open workbook in the new month?
Can this be done?
Thanks!


Jacob Skaria

macro to display message,when open workbook
 
--The code checks whether ;the workbook has been saved in the current month
and if not it will pop-up the message
--Since you have already saved the file the current month it will not
display any message...Instead save;close the file and change the system date
to any date in the next month...and try opening the workbook

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi Jacob, i paste the code into this workbook. i saved and closed everything.
i opened the workbook, but the macro didn't displayed any message. i closed
the workbook, set the time to 01.10.2009, and open again. nothing. what am i
doing wrong?
Thanks!

"Jacob Skaria" a scris:

Here we go. From workbook press Alt+F11 to launch VBE (Visual Basic Editor).
From the left treeview search for the workbook name and click on + to expand
it. Within that you should see the following

VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
This Workbook

Double click 'This WorkBook' and paste the below code to the right code pane.

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Can you help me a little bit with how to use the Workbook Open event?
Thanks!

"Jacob Skaria" a scris:

Use the Workbook Open event.....and try the below code

Private Sub Workbook_Open()
If Format(FileDateTime(Me.FullName), "mmyy") < _
Format(Date, "mmyy") Then MsgBox "first day of the month,please save"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i need a macro to display a message, first time i open workbook in new
month. If today is 01.11.2009, and i open my workbook, then, the macro to
display message "first day of the month,please save".
Sometime the first day of the month can be sunday, and i will open my
workbook, on the second day of the month, or another day. Can this macro be
made to display the message first time i open workbook in the new month?
Can this be done?
Thanks!


Jacob Skaria

macro to display message,when open workbook
 
Oops.. Please ignore the previous code...Try the below

Private Sub Workbook_Open()
If Format(Me.BuiltinDocumentProperties("Last Save Time"), "mmyy") < _
Format(Date, "mmyy") Then MsgBox "first day of the month,please save"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi Jacob, i paste the code into this workbook. i saved and closed everything.
i opened the workbook, but the macro didn't displayed any message. i closed
the workbook, set the time to 01.10.2009, and open again. nothing. what am i
doing wrong?
Thanks!

"Jacob Skaria" a scris:

Here we go. From workbook press Alt+F11 to launch VBE (Visual Basic Editor).
From the left treeview search for the workbook name and click on + to expand
it. Within that you should see the following

VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
This Workbook

Double click 'This WorkBook' and paste the below code to the right code pane.

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Can you help me a little bit with how to use the Workbook Open event?
Thanks!

"Jacob Skaria" a scris:

Use the Workbook Open event.....and try the below code

Private Sub Workbook_Open()
If Format(FileDateTime(Me.FullName), "mmyy") < _
Format(Date, "mmyy") Then MsgBox "first day of the month,please save"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i need a macro to display a message, first time i open workbook in new
month. If today is 01.11.2009, and i open my workbook, then, the macro to
display message "first day of the month,please save".
Sometime the first day of the month can be sunday, and i will open my
workbook, on the second day of the month, or another day. Can this macro be
made to display the message first time i open workbook in the new month?
Can this be done?
Thanks!


puiuluipui

macro to display message,when open workbook
 
Beautiful.
Thanks!

"Jacob Skaria" a scris:

Oops.. Please ignore the previous code...Try the below

Private Sub Workbook_Open()
If Format(Me.BuiltinDocumentProperties("Last Save Time"), "mmyy") < _
Format(Date, "mmyy") Then MsgBox "first day of the month,please save"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi Jacob, i paste the code into this workbook. i saved and closed everything.
i opened the workbook, but the macro didn't displayed any message. i closed
the workbook, set the time to 01.10.2009, and open again. nothing. what am i
doing wrong?
Thanks!

"Jacob Skaria" a scris:

Here we go. From workbook press Alt+F11 to launch VBE (Visual Basic Editor).
From the left treeview search for the workbook name and click on + to expand
it. Within that you should see the following

VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
This Workbook

Double click 'This WorkBook' and paste the below code to the right code pane.

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Can you help me a little bit with how to use the Workbook Open event?
Thanks!

"Jacob Skaria" a scris:

Use the Workbook Open event.....and try the below code

Private Sub Workbook_Open()
If Format(FileDateTime(Me.FullName), "mmyy") < _
Format(Date, "mmyy") Then MsgBox "first day of the month,please save"
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i need a macro to display a message, first time i open workbook in new
month. If today is 01.11.2009, and i open my workbook, then, the macro to
display message "first day of the month,please save".
Sometime the first day of the month can be sunday, and i will open my
workbook, on the second day of the month, or another day. Can this macro be
made to display the message first time i open workbook in the new month?
Can this be done?
Thanks!



All times are GMT +1. The time now is 02:58 PM.

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