Windows Task Scheduler running an Excel VBA script - vba

I have a VBA script in Excel that I wish to run every morning. I want to use the Windows task scheduler to run the VBA script.
I currently use windows task scheduler to run an automated MATLAB process. I have done this by putting the path of the MATLAB exe in the Program/script box and putting other parameters in the Add arguments & Start in text boxes. Is it possible to do something similar with Excel & if so how?
I have seen lots of people mention writing a VBA script which I do not wish to do.

Related

Automating HPALM Tasks with UFT

I am automating an SAP Application using UFT Tool, I have completed my Automation work in UFT and I have placed all my automation Test Scripts in HP ALM Shared Repository under the folder name Test labs and I am executing my Test scripts from HPALM.
I have a plan to automate the task of launching the HPALM and Run the Test automatically from my local machine so that the user need not need to log into the HPALM each time when he runs a Particular scenario.
In order to achieve this I have an idea to create a file on my local machine containing the name of the test cases and when selecting the Test case the script should open the ALM Connection and Run the Test, But I don't find the appropriate way to achieve this since I am a new to HPALM and VB.
Any Ideas are appreciated and thank you in advance.
Well, in Simpler terms you need to automate using OTA.
1 - You will need a file containing all the test cases and a Flag to check which test case to run - This file can be an Excel file.
2 - Write a VBScript to initiate ALM Connection, Read the cases to be executed from an excel file and execute its test scripts.
Read OTA for more details
Check out my answer for How to use 'Export to HP ALM' Addin for Excel using Macro or VbScript
You may be able to find ideas on connecting ALM through VBScript (I have used a macro, you can use a .VBS (Notepad) )
Let me know if you need more help

Need help to connect Unix through Excel

As Part of data Analysis, I need to connect excel macros with unix, fire my shell script from a macro, and get the output file back to excel. I tried using winsock, but it didn't work
This is not a very clear question...
but i suggest to split the problem into parts
test the shell script to make sure it outputs exactly what you want (including carriage returns / whitespace / other fromatting that might confuse Windows or Excel)
test your method of connecting from Windows to Unix. make sure you can run a command from PowerShell which logs in to the unix machine, runs the script, and returns the result
test your Excel macro. ensure it has permission to make the connection you made from PowerShell
You'll have better luck on StackOverflow if you post a piece of code (or network details) and the error message you got from that code.

Can you schedule periodic data imports in VBA?

I have a VBA function that, when invoked via a button on a sheet, extracts a .csv file from a website and imports it into my workbook. The problem is the file is uploaded in different time intervals during the day, so I have to periodically check the website.
Is there a way in VBA that I can schedule when a function is invoked?
You can use the Application.OnTime() method which will allow you to schedule a Macro for a specific time amongst other settings. However you're probably best using VB Script or similar.
It's also important to note that the workbook would need to be open the entire time if you are going to use VBA, whereas a VBS file will run silently and can be triggered to run at startup.
If you're proficient enough with VBA then you shouldn't have a problem writing VBS.

how to automatically run a macro at a given hour

I'm wondering if anyone here has experience with setting up a macro to run automatically at a given time... lets say 5AM.
There are some posts on mr excel but most of what I find is simply OnTime "x time" based code, and I'm unsure how this executes.
Do you have to open the sheet, run the macro and then expect it to run at the given time? Once it is open, will it run every day at that time or can you run it whenever?
You could
1] have Windows task scheduler open your workbook. Please see: http://windows.microsoft.com/en-us/windows7/schedule-a-task
2] and then create a function in your macro that launches your code when the book is opened. See http://www.mrexcel.com/forum/excel-questions/6122-run-macro-open.html for more info.
This seems to be what you want:
How can I Run Excel Files as a task or job?
Use the Windows Scheduler to schedule a task to open up the Excel file. You should then be able to use the Workbook_Open Event to do what you need with the file.

Schedule Outlook 2003 Macro

I have an Outlook 2003 macro written in VBA.
I would like to schedule it so that it automatically runs at a certain time, say 01:00. The PC is always logged on.
I couldn't find anything which suggests how to do this.
You could create a scheduled task on the PC to run daily at the specific time, and use the Outlook Command Line Switch to start the program and call your macro e.g:
"C:\Program Files\Microsoft Office\Office11\Outlook.exe" /autorun macroname
Update:
You may be able to use an API call to start a timer to run in the background of outlook, you could combine this with the VB Now() command to get the current time and if greater than your scheduling time you could trigger your macro, the API example can be found here:
http://www.outlookcode.com/threads.aspx?forumid=4&messageid=22831
http://support.microsoft.com/kb/237913/EN-US
This article says it can't be done unless you rewrite it to use CDO.
Sorry.