+ Reply to Thread
Results 1 to 7 of 7

Window>Arrange>Tiled - all xls in directory

  1. #1
    Forum Contributor
    Join Date
    11-20-2005
    Posts
    256

    Window>Arrange>Tiled - all xls in directory

    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.

    Please Login or Register  to view this content.
    Thx
    Dave
    "The game is afoot Watson"

  2. #2
    NickHK
    Guest

    Re: Window>Arrange>Tiled - all xls in directory

    What are you trying to achieve by tiling a single workbook ?
    Do these WBs have multiple windows ?

    NickHK

    "Desert Piranha"
    <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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
    >




  3. #3
    NickHK
    Guest

    Re: Window>Arrange>Tiled - all xls in directory

    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"
    <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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
    >




  4. #4
    Forum Contributor
    Join Date
    11-20-2005
    Posts
    256
    Hi Nick,

    No. I don't think any of the workbooks have multiple windows. So what i am looking for,
    is like if you just open a workbook, and then go to "Windows>Arrange>Tiled", then save and close.
    So only one workbook is open at a time, no multiple windows.

    I have a bunch of workbooks in a directory, that when opened (one at a time), open to
    various sizes on my screen. I want to change them so they open to the standard above.
    I know i can just do it manually, when i open them manually, but i'm kinda lazy so i thought
    i could just use code to set them all to that standard.

    Thx
    Dave
    Quote Originally Posted by NickHK
    What are you trying to achieve by tiling a single workbook ?
    Do these WBs have multiple windows ?

    NickHK

    "Desert Piranha"
    <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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
    >

  5. #5
    Forum Contributor
    Join Date
    11-20-2005
    Posts
    256
    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
    Quote Originally Posted by NickHK
    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"
    <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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
    >

  6. #6
    NickHK
    Guest

    Re: Window>Arrange>Tiled - all xls in directory

    Why not put them to Maximised instead, if there is only a single window.
    Tiling a single window makes no sense.
    Then you do not have be concerned with other open windows.

    NickHK

    "Desert Piranha"
    <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi Nick,
    >
    > No. I don't think any of the workbooks have multiple windows. So what i
    > am looking for,
    > is like if you just open a workbook, and then go to
    > "Windows>Arrange>Tiled", then save and close.
    > So only one workbook is open at a time, no multiple windows.
    >
    > I have a bunch of workbooks in a directory, that when opened (one at a
    > time), open to
    > various sizes on my screen. I want to change them so they open to the
    > standard above.
    > I know i can just do it manually, when i open them manually, but i'm
    > kinda lazy so i thought
    > i could just use code to set them all to that standard.
    >
    > Thx
    > Dave
    > NickHK Wrote:
    > > What are you trying to achieve by tiling a single workbook ?
    > > Do these WBs have multiple windows ?
    > >
    > > NickHK
    > >
    > > "Desert Piranha"
    > > <[email protected]> wrote in
    > > message
    > > news:[email protected]...
    > > >
    > > > 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
    >




  7. #7
    Forum Contributor
    Join Date
    11-20-2005
    Posts
    256
    Hi Nick,

    hee hee hee
    Well in my original post i said it "may sound kinda stupid"

    But i will play with this a few days, before trashing it.
    As a workaround i put a button on my toolbar.

    Thx for all your input
    Dave
    Quote Originally Posted by NickHK
    Why not put them to Maximised instead, if there is only a single window.
    Tiling a single window makes no sense.
    Then you do not have be concerned with other open windows.

    NickHK

    "Desert Piranha"
    <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi Nick,
    >
    > No. I don't think any of the workbooks have multiple windows. So what i
    > am looking for,
    > is like if you just open a workbook, and then go to
    > "Windows>Arrange>Tiled", then save and close.
    > So only one workbook is open at a time, no multiple windows.
    >
    > I have a bunch of workbooks in a directory, that when opened (one at a
    > time), open to
    > various sizes on my screen. I want to change them so they open to the
    > standard above.
    > I know i can just do it manually, when i open them manually, but i'm
    > kinda lazy so i thought
    > i could just use code to set them all to that standard.
    >
    > Thx
    > Dave
    > NickHK Wrote:
    > > What are you trying to achieve by tiling a single workbook ?
    > > Do these WBs have multiple windows ?
    > >
    > > NickHK
    > >
    > > "Desert Piranha"
    > > <[email protected]> wrote in
    > > message
    > > news:[email protected]...
    > > >
    > > > 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
    >

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1