View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
joannele71 joannele71 is offline
external usenet poster
 
Posts: 6
Default Export Excel data and scheduled task

Hi

I have the following macro to automatically export a range of excel data
into a txt file. If I run the macro manually, it works fine. But if I put
the macro to a scheduled task, the macro can't recognize the export name
(c:\joanne\test.txt~) and so a pop up window asks me for the export name.

Anything wrong with my scripts below? how to fix it?

Many thanks
joanne





Sub testEXPORT()

Workbooks.Open(Filename:="c:\joanne\reference\FLAT FILE.XLA").RunAutoMacros
Which:= _
xlAutoOpen

Workbooks("test.xls").Activate
Sheets("sheet1").Select
Application.SendKeys ("c:\joanne\test.txt~")
Range("A6").End(xlDown).Select
ActiveCell.Offset(0, 4).Select
anchor_cell2 = ActiveCell.Address
Range("A6", anchor_cell2).Select



Application.Run Macro:=Range( _
"[FLATFILE.XLA]FLATFILE!mcp01.FixedFieldExport")
Application.DisplayAlerts = True
End Sub