ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   When excel is opened need to ask a question (https://www.excelbanter.com/excel-programming/421863-when-excel-opened-need-ask-question.html)

[email protected]

When excel is opened need to ask a question
 
What day of the week it is and open a certian workbook and run a
certain macro. New to this and need some help. Do now somewhat about
vb that works inside of excel.
I would be Thankful for any help..

JLGWhiz

When excel is opened need to ask a question
 
Press Alt + F11 to open the VBE, then double click ThisWorkbook in the projet
window located upper left in the VBE window. After you add your macro name
to the code below, paste it into the ThisWorkbook code window. When you open
that workbook, the code will run. The macro you call must be in the standard
code module1.

Private Sub Workbook_Open()
MsgBox "This is " & Format(Date, "dddd, d, m")
Call 'macro name
End Sub

If the macro takes arguments the arguments must be included in partheses,
otherwise, omit the parentheses.

" wrote:

What day of the week it is and open a certian workbook and run a
certain macro. New to this and need some help. Do now somewhat about
vb that works inside of excel.
I would be Thankful for any help..


Chip Pearson

When excel is opened need to ask a question
 
It isn't at all clear what you are asking. If you mean that you want
to run a procedure depending on what day of the week it is, use code
like the following:

Sub Auto_Open()
Select Case Weekday(Now, vbSunday)
Case 1 'sunday
' run procedure 1
Case 2 'monday
' run procedure 2
Case 3 'tuesday
' run procedure 3
'... as so on to 7 = Saturday
End Select
End Sub

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Wed, 31 Dec 2008 09:19:05 -0800 (PST), wrote:

What day of the week it is and open a certian workbook and run a
certain macro. New to this and need some help. Do now somewhat about
vb that works inside of excel.
I would be Thankful for any help..



All times are GMT +1. The time now is 11:29 PM.

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