Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Open & process multiple worksheets then move them to different folder.

Hi,

I am new to VBA Excel but not new to programming.

I receive multiple worksheets every day through email (1 worksheet per
email). Then I do the following process for each of the worksheets:

1. Save the worksheet as workfile.xls to the folder "H:/To be
processed/".
2. Process the worksheet.
3. Move the worksheet to the folder "H:/Processed".

So basically my code just works only when the name of the file is
workfile.xls and when it is situated in so and so folder. But I want
to automate this process and want the code to pick up not one but all
worksheets, one after other independent of their names, process each
of them and once processing is done then move each of those to a
different folder. I don't want to hardcode the folder name but want
the code to pick it up as parameter or take it from somewhere.

I think it is possible to do the above. I need some
help/suggestions/example codes I can refer to.

Thanks in advance,
Prasad Vanka
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default Open & process multiple worksheets then move them to different folder.

Hi Prasad,

So basically my code just works only when the name of the file is
workfile.xls and when it is situated in so and so folder. But I want
to automate this process and want the code to pick up not one but all
worksheets, one after other independent of their names, process each
of them and once processing is done then move each of those to a
different folder. I don't want to hardcode the folder name but want
the code to pick it up as parameter or take it from somewhere.


Something like this?

Sub GetOpenFileNameExample2()
Dim vFilename As Variant
Dim sPath As String
Dim lFilecount As Long
Dim lCount As Long
sPath = "c:\windows\temp\"
ChDrive sPath
ChDir sPath
vFilename = Application.GetOpenFilename("Microsoft Excel files
(*.xls),*.xls", , "Please select the file(s) to process", , True)
If TypeName(vFilename) = "Boolean" Then Exit Sub
For lCount = 1 To UBound(vFilename)
MsgBox vFilename(lCount)
'Process your file(s) here
Next
End Sub

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

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 do I open multiple worksheets each in its own tab gerschwynne Excel Discussion (Misc queries) 3 August 10th 09 10:47 PM
Move sorted data from one worksheet to multiple worksheets? Mark Excel Worksheet Functions 1 October 4th 07 09:32 AM
How to get each spreadsheet to open in a seperate process? Horrgakx Excel Discussion (Misc queries) 3 November 21st 06 02:57 PM
Open multiple files into multiple worksheets of the same workbook lil Matt Excel Discussion (Misc queries) 1 October 31st 06 09:03 PM
search multiple worksheets name with common text and process using mango Excel Worksheet Functions 1 December 22nd 04 02:11 PM


All times are GMT +1. The time now is 07:31 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"