Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Get filename

i use getopenfilename to get a excel file and open it, and copy certain
range within 2 files.

my problem is i don't know how to switch within 2 windows.

i try to use workbook(filename).activate, but the filename variable include
the path as well.

regards


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Get filename

One way:

Dim wbBook1 As Workbook
Dim wbBook2 As Workbook
Dim vFileName As Variant
Set wbBook1 = ActiveWorkbook
vFileName = Application.GetOpenFilename
If vFileName = False Then Exit Sub
Set wbBook2 = Workbooks.Open(Filename:=vFileName)

Then use

wbBook2.Activate

and

wbBook1.Activate

to switch.



In article ,
"Tang" wrote:

i use getopenfilename to get a excel file and open it, and copy certain
range within 2 files.

my problem is i don't know how to switch within 2 windows.

i try to use workbook(filename).activate, but the filename variable include
the path as well.

regards

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
filename.xls:1 and filename.xls:2 Christina C. Excel Discussion (Misc queries) 7 November 27th 07 10:39 PM
Cell("filename") doesn't update to new filename when do save as. Louis Excel Worksheet Functions 2 March 22nd 07 07:27 PM
set filename to <filename-date on open bob engler Excel Worksheet Functions 2 July 13th 06 05:11 AM
Saving filename same as import filename Matt Excel Programming 4 February 24th 04 03:01 PM
how to specify the filename gptg13 Excel Programming 0 December 18th 03 11:31 PM


All times are GMT +1. The time now is 11: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"