Home |
Search |
Today's Posts |
#24
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
after opening existing spreadsheet can't input data anymore | Excel Worksheet Functions | |||
Opening a file with User Input | Excel Discussion (Misc queries) | |||
opening an excel file opens a duplicate file of the same file | Excel Discussion (Misc queries) | |||
Opening a template form & renaming it from a cell input automatica | Excel Discussion (Misc queries) | |||
Opening a text file for input | Excel Programming |