Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Export Excel data and scheduled task

I can't tell from which workbooks you are trying to run the macros. I tried
modifying the code but probably got the workbooks wrong.

Sub testEXPORT()

set Flatfile = Workbooks.Open( _
Filename:="c:\joanne\reference\FLATFILE.XLA").RunA utoMacros _
Which:=xlAutoOpen

with Workbooks("test.xls").Sheets("sheet1")
.Application.SendKeys ("c:\joanne\test.txt~")
set LastCell = .Range("A6").End(xlDown)
anchor_cell2 = Last.Offset(0, 4).Address
Range("A6", anchor_cell2).Select
.Application.Run Macro:=Range( _
"[FLATFILE.XLA]FLATFILE!mcp01.FixedFieldExport")
.Application.DisplayAlerts = True
end with
End Sub

"joannele71" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Export Excel data and scheduled task

Hi Joel,

I am trying to run the macro on the test.xls file.

The first line of the macro (same as below) is to open the flat file in
which it shows the Export option in Excel.
Workbooks.Open(Filename:="c:\joanne\reference\FLAT FILE.XLA").RunAutoMacros
Which:= xlAutoOpen

I hope this helps.

Thanks
Joanne


"Joel" wrote:

I can't tell from which workbooks you are trying to run the macros. I tried
modifying the code but probably got the workbooks wrong.

Sub testEXPORT()

set Flatfile = Workbooks.Open( _
Filename:="c:\joanne\reference\FLATFILE.XLA").RunA utoMacros _
Which:=xlAutoOpen

with Workbooks("test.xls").Sheets("sheet1")
.Application.SendKeys ("c:\joanne\test.txt~")
set LastCell = .Range("A6").End(xlDown)
anchor_cell2 = Last.Offset(0, 4).Address
Range("A6", anchor_cell2).Select
.Application.Run Macro:=Range( _
"[FLATFILE.XLA]FLATFILE!mcp01.FixedFieldExport")
.Application.DisplayAlerts = True
end with
End Sub

"joannele71" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
After Windows update scheduled task uses wrong version of Excel CharlesW Excel Discussion (Misc queries) 0 July 15th 09 04:53 PM
Run Excel macro from Scheduled Task coolthinking Excel Worksheet Functions 4 July 13th 09 03:35 PM
Trying to run a MSQuery from Excel as a Scheduled Task Doug Excel Discussion (Misc queries) 1 March 6th 09 06:01 PM
Manipulate Excel file via scheduled task? Ronald S. Cook Excel Programming 0 August 23rd 06 05:58 PM
Running an Excel Macro as a Scheduled Task Dan Youngren via OfficeKB.com Excel Programming 1 June 7th 05 11:32 PM


All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"