![]() |
How to code VBA: Auto open workbook and run macro
Hello all,
I need to create excel vba in order to auto open workbook in specific time. I setup Windows Scheduled Tasks to open excel everyday for example at 2:00 pm. I need the workbook to open at this time too and run macros. After the job done, I want to send email to my email to say that job is finished. I don't know what to start. Please give me suggestion. March |
How to code VBA: Auto open workbook and run macro
In the VBE, use a Workbook_Open macro to define what you want done when the
workbook is opened. Once the workbook is created, you can use your Windows Scheduled tasks to open it at 2 PM and it should run. Do you have specific questions on how to code something? -- HTH, Barb Reinhardt "March" wrote: Hello all, I need to create excel vba in order to auto open workbook in specific time. I setup Windows Scheduled Tasks to open excel everyday for example at 2:00 pm. I need the workbook to open at this time too and run macros. After the job done, I want to send email to my email to say that job is finished. I don't know what to start. Please give me suggestion. March |
How to code VBA: Auto open workbook and run macro
Thank you to reply.
My question is between Private Sub Workbook_Open() End Sub My understanding now is when I use Workbook_Open( ) in my workbook, everytime when I open excel this workbook should be auto opened. Am I right? If yes, I don't want the workbook open all time I open excel. I need it to open only at 2:00 pm. So this point I don't know how to tell excel to open the file at the fixed time. I am not sure that "How excel knows which file should be opened????" March "Barb Reinhardt" wrote: In the VBE, use a Workbook_Open macro to define what you want done when the workbook is opened. Once the workbook is created, you can use your Windows Scheduled tasks to open it at 2 PM and it should run. Do you have specific questions on how to code something? -- HTH, Barb Reinhardt "March" wrote: Hello all, I need to create excel vba in order to auto open workbook in specific time. I setup Windows Scheduled Tasks to open excel everyday for example at 2:00 pm. I need the workbook to open at this time too and run macros. After the job done, I want to send email to my email to say that job is finished. I don't know what to start. Please give me suggestion. March |
How to code VBA: Auto open workbook and run macro
Rather than open excel at 2pm, open the workbook
Run c:\<path to your WB\My Workbook.xls Excel should start and then open the workbook. At this point the Workbook_Open() event will execute. Note however, unless you have security level set to low (See Tools / Marco / Security / Security Level Tab for details), you will get a prompt asking if you want to disable macros. This would have to be clicked before the event fires. JohnGoogle |
How to code VBA: Auto open workbook and run macro
This is the easy part. Just select the file you want to run and set the
date to whenever you want it run. http://support.microsoft.com/default.aspx/kb/308569 -- HTH, Barb Reinhardt "March" wrote: Thank you to reply. My question is between Private Sub Workbook_Open() End Sub My understanding now is when I use Workbook_Open( ) in my workbook, everytime when I open excel this workbook should be auto opened. Am I right? If yes, I don't want the workbook open all time I open excel. I need it to open only at 2:00 pm. So this point I don't know how to tell excel to open the file at the fixed time. I am not sure that "How excel knows which file should be opened????" March "Barb Reinhardt" wrote: In the VBE, use a Workbook_Open macro to define what you want done when the workbook is opened. Once the workbook is created, you can use your Windows Scheduled tasks to open it at 2 PM and it should run. Do you have specific questions on how to code something? -- HTH, Barb Reinhardt "March" wrote: Hello all, I need to create excel vba in order to auto open workbook in specific time. I setup Windows Scheduled Tasks to open excel everyday for example at 2:00 pm. I need the workbook to open at this time too and run macros. After the job done, I want to send email to my email to say that job is finished. I don't know what to start. Please give me suggestion. March |
All times are GMT +1. The time now is 02:19 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com