Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I open a workbook using a different window Dean Menzies Excel Discussion (Misc queries) 1 August 31st 08 01:42 PM
Detecting if a Window/Workbook is Open Rob Excel Discussion (Misc queries) 5 July 10th 07 10:52 PM
Workbook to Open a new excel Window Jason Zischke Excel Programming 1 March 22nd 06 11:33 AM
Excel workbook does not open in open window on desktop DeanH Excel Discussion (Misc queries) 2 March 8th 05 09:51 AM
deleting second open window in a workbook mark in leisure Excel Worksheet Functions 2 November 8th 04 02:09 PM


All times are GMT +1. The time now is 12:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"