View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
haisat[_7_] haisat[_7_] is offline
external usenet poster
 
Posts: 1
Default Running a Excel Macro from Windows Scheduler


Hi Patrik,
Thanks a lot for your response. I tried your code and it is working.
But I am little confused how to make it work for me. I am giving My
requirement clearly...
I am trying to plot a graph by taking values from a file. For this I
wrote a Macro. Now I want this macro to be run daily at particular
time. Code of the macro is pasted below.


Sub swapmemory()
'
' swapmemory Macro
' Macro recorded 10/20/2003 by ibm user
'
' Keyboard Shortcut: Ctrl+q
'
Dim sDate As String
Dim sfile As String

sDate = Format(Date, "mmddyy")
sfile = "swapmemory_results." & sDate
ChDir "C:\new Applications\Tower-G"
Workbooks.OpenText Filename:= _
"C:\new Applications\Tower-G\results\" & sfile,
Origin:=xlWindows, _
StartRow:=1, DataType:=xlDelimited,
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False,
Comma:=False _
, Space:=False, Other:=False, FieldInfo:=Array(1, 1)
Range("A1:A340").Select
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets(sfile).Range( _
"A1:A340"), PlotBy:=xlColumns
ActiveChart.Location Whe=xlLocationAsObject, Name:= _
sfile
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Swap Memory Results -- GLITR"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = _
"time(each unit = 5min)"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Kb"
End With
End Sub

Could you please tell me how to run this macro daily at particular time
using windows scheduler.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/