LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #24   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Opening a file through input of first 3 digits

I can't believe that is what you want. I was trying to show you what the
macro does. Having it reopen other workbooks, especially if they are linked
is not what you want. Can we make the workbook to open, always the active
Cell. So you pick the first cell with a workbook name and run the macro,
then it will open that workbook and activate the next cell, ready for you
to run it again?

Public Sub ProcessFiles()
Dim sPath as String, sName as String
sPath = "C:\Myfolder\MyFolder1|"
if Activeworkbook.name < thisworkbook.Name then
Activesheet.Printout
Activeworkbook.close Savechanges:=True
end if
thisworkbook.Activate
Worksheets("List").Activate
if Selection.Count 1 then
selection(1).Select
End if
if activecell.Column < 1 then
Range("A2").Select
end if
if not isempty(activecell) then
sName = ActiveCell.Value
activeCell.offset(1,0).Select
workbooks.open sPath & sName
else
Msgbox "Done"
End if
End sub

Assumes first name is in A2 on a sheet named list in the workbook containing
the code and the list is on the activeworksheet when you first run the
macro. So

Run the macro
This will open the workbook.

You can make your changes, then run the macro

It will print the activeworksheet (the one where you made your changes),
then close and save it, and open the next file from the list

Keep making your changes and running the macro. It will tell you when you
have reached a blank cell.


--
Regards,
Tom Ogilvy


"Starting to Program" wrote in
message ...

Tom,

Almost there, the only problem I now have is that if once the list

contains only one file it loads the first file from the directory its
pointed at, and continues to try to load this file until I say no.

Do you know why this would be? This was obviously what was happening

before when it was looping through when I was testing it.

I am just curious about this and can live with it, as my list will almost

always contain more than one value, if I could fix this problem thats great
otherwise no problem.

Have a great day and thanks again.

Mark



 
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 opening existing spreadsheet can't input data anymore rls Excel Worksheet Functions 2 October 6th 08 03:36 AM
Opening a file with User Input [email protected] Excel Discussion (Misc queries) 3 March 28th 07 03:00 AM
opening an excel file opens a duplicate file of the same file skm Excel Discussion (Misc queries) 1 December 7th 05 05:52 PM
Opening a template form & renaming it from a cell input automatica John Galt Excel Discussion (Misc queries) 0 April 19th 05 09:16 PM
Opening a text file for input [email protected] Excel Programming 5 January 8th 04 05:11 AM


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