View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Open Excel in New Window using a Macro

How about:

Option Explicit
Sub open_Wiresheet()

Dim SchedWkbk As Workbook

Set SchedWkbk = Nothing
On Error Resume Next
Set SchedWkbk = Workbooks.Open _
("O:\SEM\Common\Accounting\Mar-07 Wire Transfer Schedule.xls")
On Error Resume Next

If SchedWkbk Is Nothing Then
MsgBox prompt:="Cannot find file. Please open file manually", _
Buttons:=vbOKOnly + vbQuestion
else
'your code that arranges the windows the way you want
'something like:
Windows.Arrange ArrangeStyle:=xlVertical
End If
End Sub

And if you record a macro when you use:
Window|Arrange|vertical

You'll have the code that you need.


David T wrote:

Hey guys-

I need a macro to open a file in a separate window so that I can view the
current file and the new file side by side. My current macro is opening the
file within the same window. I also need a message box that will say "Can
not file file" if the macro cannot find the file. My current macro opens the
message box regardless if if finds the file or not. Can someone
help???????????!!!!!!!!!!!1

Sub open_Wiresheet()
On Error GoTo Exits

Application.Workbooks.Open ("O:\SEM\Common\Accounting\Mar-07 Wire Transfer
Schedule.xls")

Exits: reply = Msgbox("Cannot find file. Please open file manually", vbOK
Or vbQuestion)

If reply = vbOK Then

Exit Sub
End If
End Sub


--

Dave Peterson