LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Save sheet as .TXT out of Workbook


I would like to save a sheet as .TXT out of a workbook. This works fine
but if:

I have several workbooks open and I switched between the workbooks by
minimizing them (in stead of using the menu "window") the code doesn't
work properly because the copied sheet is not the active sheet and the
code will save the original workbook as a .TXT...

code:
Sheets("BESPRO MT").Select 'sheet to copy and save as .txt
Sheets("BESPRO MT").Copy
DLSfile = "DL72112.txt"
ActiveWorkbook.SaveAs FileName:=path & DLSfile, FileFormat:=xlText,
CreateBackup:=False
ActiveWindow.Close 'should close dl72112.txt but see problem above...
Windows(FileName).Activate
Sheets("BESPRO MT").Delete


I tried with maximize window and also with activate but it didn't
work...

any idea?


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

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
 
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
Please help! When I 'save changes' to my workbook/sheet V Excel Discussion (Misc queries) 0 May 18th 09 10:22 PM
Save Sheet as Workbook salonowiec Excel Discussion (Misc queries) 2 June 26th 07 04:03 PM
Select sheet tabs in workbook & save to separate workbook files stratocaster Excel Worksheet Functions 2 March 1st 06 03:35 PM
Can I only save one sheet out of the workbook? PeterM Excel Discussion (Misc queries) 4 September 1st 05 04:42 AM
Save sheet as .TXT out of Workbook goepf Excel Programming 2 November 13th 03 01:22 PM


All times are GMT +1. The time now is 05:28 PM.

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"