J
joannele71
Hi
I am trying to write a macro to export my data in Excel as a text file. The
followings are my codes. However, the macro works only when I am running it
manually on Excel. The macro fails to run when I schedule it to run. It
stops when the Export window pop up. What should I change in my macro to
make it works?
Sub testEXPORT()
Workbooks.Open(Filename:="c:\FLATFILE.XLA").RunAutoMacros Which:= _
xlAutoOpen
Workbooks("test.xls").Activate
Sheets("sheet1").Select
Range("A6").End(xlDown).Select
ActiveCell.Offset(0, 4).Select
anchor_cell2 = ActiveCell.Address
Range("A6", anchor_cell2).Select
Application.SendKeys ("c:\test.txt~")
Application.SendKeys ("Y~")
Application.Run Macro:=Range( _
"[FLATFILE.XLA]FLATFILE!mcp01.FixedFieldExport")
End Sub
Thanks
Joanne
I am trying to write a macro to export my data in Excel as a text file. The
followings are my codes. However, the macro works only when I am running it
manually on Excel. The macro fails to run when I schedule it to run. It
stops when the Export window pop up. What should I change in my macro to
make it works?
Sub testEXPORT()
Workbooks.Open(Filename:="c:\FLATFILE.XLA").RunAutoMacros Which:= _
xlAutoOpen
Workbooks("test.xls").Activate
Sheets("sheet1").Select
Range("A6").End(xlDown).Select
ActiveCell.Offset(0, 4).Select
anchor_cell2 = ActiveCell.Address
Range("A6", anchor_cell2).Select
Application.SendKeys ("c:\test.txt~")
Application.SendKeys ("Y~")
Application.Run Macro:=Range( _
"[FLATFILE.XLA]FLATFILE!mcp01.FixedFieldExport")
End Sub
Thanks
Joanne