Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In some minor testing, this only caused a problem for me if the worksheet window
was not maximized. If I maximized the worksheet window, then opened a workbook that had its windows minimized, it was opened maximized (did that make sense???). So I could add a line before showing the dialog that maximizes the window: ActiveWindow.WindowState = xlMaximized Another option is to just open it and then maximize it. I like displaying the getopenfilename dialog and controlling what happens later. Option Explicit Sub testme01() Dim wkbk As Workbook Dim myFileName As Variant myFileName = Application.GetOpenFilename("Excel File, *.xls") If myFileName = False Then Exit Sub 'user hit cancel End If Set wkbk = Workbooks.Open(Filename:=myFileName) wkbk.Windows(1).WindowState = xlMaximized End Sub schpank wrote: I am using a dialog box to have the user select an open file, but if the file opened happens to be saved as minimized, it does not activate. I am just trying to copy some data from the opened file, then go back to the file with the macro to paste etc. Seems like there should be a way to reference the newly opened file and activate it? Or open it and activate it as one step? any help appreciated: Application.Dialogs(xlDialogOpen).Show arg1:="" Range("$A$1:$A$6").Select Range(Selection, Selection.End(xlToRight)).Select Selection.Copy ThisWorkbook.Activate -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
can't seem to activate an open workbook | Excel Discussion (Misc queries) | |||
How to auto activate macro when file open ? | Excel Worksheet Functions | |||
Workbook.activate | Excel Discussion (Misc queries) | |||
Excel VBA - Activate Open Workbooks to format | Excel Programming | |||
Activate Workbook | Excel Programming |