Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
open workbook in new window using VBA
Hi, I have macro which opens workbbok in new window but I am getting
the same window as activated. But I want original workbbok should be activated. Please help me? Please find below code for the reference. Sub test() Dim MWBK As Workbook Set MWBK = ActiveWorkbook Dim exlApp As Excel.Application Set exlApp = New Excel.Application exlApp.Visible = True exlApp.Workbooks.Open "D:\Documents and Settings\n404591\Desktop \test.xls" MWBK.Activate End Sub Thanks, Ganesh K. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
open workbook in new window using VBA
Or, perhaps more importantly, - why do you need 2 intances of Excel
running? Can't you have the test.xls openned in the same instance of Excel you're already running? Then your code would work. On Mar 7, 1:31*pm, ganesh25 wrote: Hi, I have macro which opens workbbok in new window but I am getting the same window as activated. But I want original workbbok should be activated. Please help me? Please find below code for the reference. Sub test() * * Dim MWBK As Workbook * * Set MWBK = ActiveWorkbook * * Dim exlApp As Excel.Application * * Set exlApp = New Excel.Application * * exlApp.Visible = True * * exlApp.Workbooks.Open "D:\Documents and Settings\n404591\Desktop \test.xls" * * MWBK.Activate End Sub Thanks, Ganesh K. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
open workbook in new window using VBA
In message
s.com of Mon, 7 Mar 2011 07:34:30 in microsoft.public.excel.programming , AB writes Or, perhaps more importantly, - why do you need 2 intances of Excel running? Can't you have the test.xls openned in the same instance of Excel you're already running? Then your code would work. Because that is the way the OP wants it to work. What version of Excel is the OP running? I run Excel 2003. On Mar 7, 1:31*pm, ganesh25 wrote: Hi, I have macro which opens workbbok in new window but I am getting the same window as activated. But I want original workbbok should be activated. Please help me? Please find below code for the reference. Sub test() * * Dim MWBK As Workbook * * Set MWBK = ActiveWorkbook * * Dim exlApp As Excel.Application * * Set exlApp = New Excel.Application * * exlApp.Visible = True * * exlApp.Workbooks.Open "D:\Documents and Settings\n404591\Desktop \test.xls" * * MWBK.Activate End Sub I changed the name passed to Open to name a file on my system. I changed the window sizes with "Restore Down". I had 2 windows open after running the code. I have an application which uses the model the OP is trying to use. An Excel file macro puts some data from the Internet on the screen. It then grabs some user input and writes data to a second Excel file. It then mail merges that second file with a Word file. The only problem I found was that Excel crashed if the equivalent of exlApp.Quit happened too soon after the second file was closed. I solved that by deferring the quit until the mail merge was done. -- Walter Briscoe |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I open a workbook using a different window | Excel Discussion (Misc queries) | |||
Detecting if a Window/Workbook is Open | Excel Discussion (Misc queries) | |||
Workbook to Open a new excel Window | Excel Programming | |||
Excel workbook does not open in open window on desktop | Excel Discussion (Misc queries) | |||
deleting second open window in a workbook | Excel Worksheet Functions |