ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   windows.activatenext (https://www.excelbanter.com/excel-programming/338049-windows-activatenext.html)

Bonzo123

windows.activatenext
 

YYY = activeworkbookname

I then open a workbook with

FileToOpen = Application.GetOpenFilename("Excel File (*.xls), *.xls",
"Select Your File", , False)

copy a range in the newly open book

activate the workbook called YYY (activeworkbookname)

and paste

I now need to reopen the "FileToOpen" book. The windows.activatenex
does not work for me as the user may have other workbooks open and V
MAY activate the wrong book

Any tricks will be appreciate

--
Bonzo12
-----------------------------------------------------------------------
Bonzo123's Profile: http://www.excelforum.com/member.php...fo&userid=2418
View this thread: http://www.excelforum.com/showthread.php?threadid=39814


Tom Ogilvy

windows.activatenext
 
Dim bk as Workbook
FileToOpen = Application.GetOpenFilename("Excel File (*.xls), *.xls", ,
"Select Your File", , False)

workbooks.Open FileToOpen

set bk = ActiveWorkbook
copy a range in the newly open book

bk.Activate

--
Regards,
Tom Ogilvy

"Bonzo123" wrote in
message ...

YYY = activeworkbookname

I then open a workbook with

FileToOpen = Application.GetOpenFilename("Excel File (*.xls), *.xls", ,
"Select Your File", , False)

copy a range in the newly open book

activate the workbook called YYY (activeworkbookname)

and paste

I now need to reopen the "FileToOpen" book. The windows.activatenext
does not work for me as the user may have other workbooks open and VB
MAY activate the wrong book

Any tricks will be appreciated


--
Bonzo123
------------------------------------------------------------------------
Bonzo123's Profile:

http://www.excelforum.com/member.php...o&userid=24182
View this thread: http://www.excelforum.com/showthread...hreadid=398142




Bonzo123[_2_]

windows.activatenext
 

Thanks Tom.

Regards

Brian


--
Bonzo123
------------------------------------------------------------------------
Bonzo123's Profile: http://www.excelforum.com/member.php...o&userid=24182
View this thread: http://www.excelforum.com/showthread...hreadid=398142



All times are GMT +1. The time now is 08:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com