Thread: Macro again..
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Macro again..

option explicit
sub testme()
dim myFileName as variant
dim newwkbk as workbook
dim CurWks as worksheet

myfilename = application.getopenfilename("excel files, *.xls")
if myfilename = false then
exit sub
end if

set curwks = activesheet

set newwkbk = workbooks.open(filename:=myfilename)

newwkbk.worksheets(1).copy _
befo=curwks

newwkbk.close savechanges:=false

end sub

May get you started.



Sylvia wrote:

Hi..

I have to write one macro which will add a button allowing Copy
function. This button should allow us to copy the whole contents of
some another Excel file (containing single tab) into the currently open
file.

For this I also need to add a search box which will allow me to search
and select the file in windows after clicking on the above button and
then proceed further..

Can anyone help me for this?

Thanks,
Sylvia

--
Sylvia
------------------------------------------------------------------------
Sylvia's Profile: http://www.excelforum.com/member.php...o&userid=30300
View this thread: http://www.excelforum.com/showthread...hreadid=500573


--

Dave Peterson