Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Loop through files

XL2000
Each day a user is required to work on 3 files. I would like to set up a
4th file to open each one separately, work on it and when it is closed,
open the next until work on all 3 is done. Each of the files already
contains a 'Done' button that triggers code to save and close it when
through working on it.

--
David
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Loop through files

David,

If I'm right you do not need another file.
File 1 is open set the Done button to open file 2.
set file 2 to open fille 3 when done.
set file 3 to save and close.

The macro below was recorded. You can change the format to suit you
needs. Post it before your save and close command in file 1 and fil
2.

HTH

Charles


Workbooks.Open Filename:= _
"C:\Documents and Settings\Charles Harmon\M
Documents\Odoms.xls

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Loop through files

Charles < wrote

If I'm right you do not need another file.
File 1 is open set the Done button to open file 2.
set file 2 to open fille 3 when done.
set file 3 to save and close.


Thought of that, but don't like files 1 or 2 open after opening the next.
That would also require returning focus to 1 or 2 to save/close.

Plus I have occasion to open these files individually, so I planned on
using the 4th file only when working on all 3 in tandem.

Thanks, anyway.

Anyone else?

--
David
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Loop through files

David,


Ok next suggestion. Create a Userform to open selected files.
On file 4 create a CommandButton to start the Userform.

Sub Show_Userform()'this is in the Code module for sheet code
Userform1.Show
End Sub


With this you need to set your Done button to show the Userform agai
after the Save, Close. The code is userform1.show
Have the Userform with OptionButtons and 2 CommandButtons. Th
following sample is something you can work with.


Private Sub CommandButton1_Click()''Loops thru to chk value
With Userform1
If .OptionButton1.Value = True Then
Workbooks.Open Filename:="G:\Users\CC\File1"
''' Now hide the Userform''
Me.Hide
ElseIf .OptionButton2.Value = True Then
Workbooks.Open Filename:="G:\Users\CC\File2"
''' Now hide the Userform''
Me.Hide
ElseIf .OptionButton3.Value = True Then
Workbooks.Open Filename:="G:\Users\CC\File3"
''' Now hide the Userform''
Me.Hide
End If
End With
End Sub

Private Sub CommandButton2_Click()'' the Done or exit button
Unload Userform1
'' Save file''
" Close file4''
End Sub


Once again I HTH

Charle

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Loop through files

Charles < wrote

Ok next suggestion. Create a Userform to open selected files.
On file 4 create a CommandButton to start the Userform.


I already have a custom menu loading when I start Excel that contains
entries for the individual files, so that wouldn't add to my present
capability. What I want to do is add a 4th entry to that menu that will
open a file that loads the other 3 sequentially. Interesting idea, though.

With this you need to set your Done button to show the Userform again
after the Save, Close. The code is userform1.show


I don't think a line would execute after the file was closed.

Have the Userform with OptionButtons and 2 CommandButtons. The
following sample is something you can work with.


You've put a lot of effort into trying to come up with a solution for me
and I appreciate it. Your suggestion would indeed work for what it is, but
again, it doesn't do anything beyond my present menu system.

I guess there is no batch method available to do what I want:

1) open file 1 for data entry
2) wait for user to save & close
3) open file 2 for data entry
4) wait for user to save & close
5) open file 3 for data entry

I would add this file to the top of my existing menu to process the files
in succession, or I could elect to open the files individually from the
other single menu entries.

If our systems were more powerful (more memory & faster processors), I
would write code that would just open all three at once and allow the user
operate on them. Sadly, the head organization is cheap, and such a method
would be constantly writing to the page file.

--
David


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Loop through files

David,

One more time.

1) open file 1 for data entry

in your code for the done command try something like this

Workbooks("test1.xls").Save
Workbooks.Open Filename:= _
"C:\Documents and Settings\Charles Harmon\M
Documents\test2.xls"
Workbooks("test1.xls").Close

Do something like this for each of your Done except possibly for fil
3.

You can also do something similar to file 4

If something like this doesn't work the I'm not understanding you
delima.

HTH

Charle

--
Message posted from http://www.ExcelForum.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
open files in loop with date order [email protected] Excel Discussion (Misc queries) 5 September 24th 07 01:10 AM
Counting files using Loop Ron[_13_] Excel Programming 0 October 28th 03 07:45 PM
Counting files using Loop Ron[_13_] Excel Programming 0 October 28th 03 07:45 PM
Counting files using Loop Ron[_13_] Excel Programming 0 October 28th 03 07:45 PM
Loop thru files in DIR, delete worksheets & reset worksheet Name property?? Mike Taylor Excel Programming 1 October 24th 03 04:14 AM


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