View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Desert Piranha[_84_] Desert Piranha[_84_] is offline
external usenet poster
 
Posts: 1
Default WindowArrangeTiled - all xls in directory


Hi Nick,

This seems promising,

I'm getting a error of:

Run-time Error '1004'
C:\Documents and Settings\Owner\Desktop\Tiled Testing\Top251.xls
Could not be found. Check spelling ~~~

The line below in the code, is highlighted in Yellow
Set wb = Workbooks.Open(MyPath & "\" & TheFile)

There is no such workbook or file by this name. --(Top251.xls)

thx Dave
NickHK Wrote:
Put the code in Personal.xls and run it from a menu entry.
Also, close all open WBs before you run the tiling code.
For each wb in Application.Workbooks
If wb.name<me.name then
wb.close
end if
Next

NickHK

"Desert Piranha"
<Desert.Piranha.2aax5b_1151815802.7309@excelforu m-nospam.com wrote in
message
news:Desert.Piranha.2aax5b_1151815802.7309@excelfo rum-nospam.com...

Hi all,

This may sound kinda stupid but what i am trying to do is open all
workbooks in a directory
"One at a time" and do the "Windows.Arrange ArrangeStyle:=xlTiled"

code
on them.

One issue is the workbook where the code is, obviously is open, to
start the macro.
This doesn't work because if another workbook opens then there are

two
windows tiled.
I don't want that.

Another issue is the code saves and closes the workbooks, and since

the
workbook with the code
is open, that won't work,

So Any Ideas?

Just in case this might somehow work, here is the code i am trying

to
use.
And i apologize i don't know whose it is.


Code:
--------------------
Sub AllFolderFiles()
Dim wb As Workbook
Dim TheFile As String
Dim MyPath As String
Application.ScreenUpdating = False
Application.EnableEvents = False
'Put folder path next line.
MyPath = "C:\Documents and Settings\Owner\Desktop\Tiled Testing"
ChDir MyPath
TheFile = Dir("*.xls")
Do While TheFile < ""
Set wb = Workbooks.Open(MyPath & "\" & TheFile)
'Your code goes here.
Windows.Arrange ArrangeStyle:=xlTiled
wb.Close SaveChanges:=True
TheFile = Dir
Loop
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
--------------------


--
Desert Piranha



------------------------------------------------------------------------
Desert Piranha's Profile:

http://www.excelforum.com/member.php...o&userid=28934
View this thread:

http://www.excelforum.com/showthread...hreadid=557636



--
Desert Piranha


------------------------------------------------------------------------
Desert Piranha's Profile: http://www.excelforum.com/member.php...o&userid=28934
View this thread: http://www.excelforum.com/showthread...hreadid=557636