Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ren Ren is offline
external usenet poster
 
Posts: 67
Default Exporting selected tabs multiple times to different file names

I have a file ("orinignal") that has tabs one, two, three.....

I want to write a macro to export tabs to seperate files and save them
automatically. FIle one would include tab one, two, three. File two would
include tab one, two, four, etc.

I know i can do

Sheets(Array("one", "two", "three")).Select
Sheets(Array("one", "two", "three")).Copy
ActiveWorkbook.SaveAs Filename:= _
"C:\one.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Windows("original.xls").Activate

My question is how do i get back to the original file without hardcoding the
file name like in windows("original.xls").active. Is there a method I can use
to get the file name and save it in a text string and refere it back by using
windows(string).activate .

I am also wondering how i can get a user input text box in excel so I can
ask the user where to save it. I can't remember the method and was probably
searching for the wrong terms in google.

Thanks,

Steven

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Exporting selected tabs multiple times to different file names

Dim mySelection as Range
set mySelection = selection
'do your work
application.goto myselection



Ren wrote:

I have a file ("orinignal") that has tabs one, two, three.....

I want to write a macro to export tabs to seperate files and save them
automatically. FIle one would include tab one, two, three. File two would
include tab one, two, four, etc.

I know i can do

Sheets(Array("one", "two", "three")).Select
Sheets(Array("one", "two", "three")).Copy
ActiveWorkbook.SaveAs Filename:= _
"C:\one.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Windows("original.xls").Activate

My question is how do i get back to the original file without hardcoding the
file name like in windows("original.xls").active. Is there a method I can use
to get the file name and save it in a text string and refere it back by using
windows(string).activate .

I am also wondering how i can get a user input text box in excel so I can
ask the user where to save it. I can't remember the method and was probably
searching for the wrong terms in google.

Thanks,

Steven


--

Dave Peterson
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
How to get range names to Apply across multiple tabs TrippKnightly Excel Worksheet Functions 1 August 10th 11 03:48 PM
Exporting file names to excel [email protected][_2_] Excel Programming 3 August 1st 07 05:02 PM
copy selected tabs from multiple workbooks to a new workbook chris Excel Worksheet Functions 0 July 12th 07 03:46 PM
Exporting to a CSV file from multiple worksheets Neale[_2_] Excel Programming 0 May 31st 07 02:47 PM
Exporting from multiple worksheets to single text file Chris Dunigan Excel Programming 3 September 16th 03 02:48 PM


All times are GMT +1. The time now is 05:11 AM.

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

About Us

"It's about Microsoft Excel"