Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Joy Joy is offline
external usenet poster
 
Posts: 29
Default how to load a file

I am new to Excel vba programming. I am stuck with a problem:
We want to put a button on an Excel sheet. when user clicks it, there will
be browse message box popping up, and user can select a file stored in local
disk. When it is successfully loaded, the macro could read data from the file.

Can anyone give some sketch of how to do it?

many many thanks!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default how to load a file

You could start with this which displays your default folder.

Sub open_file()
filetoopen = Application _
.GetOpenFilename("Excel Files (*.xls), *.xls")
If filetoopen < False Then
Workbooks.Open Filename:=filetoopen
End If
End Sub

Browse to your workbook and Open it.

Note: the opened workbook will now be Activeworkbook.


Gord Dibben MS Excel MVP

On Tue, 1 Jun 2010 09:04:01 -0700, Joy
wrote:

I am new to Excel vba programming. I am stuck with a problem:
We want to put a button on an Excel sheet. when user clicks it, there will
be browse message box popping up, and user can select a file stored in local
disk. When it is successfully loaded, the macro could read data from the file.

Can anyone give some sketch of how to do it?

many many thanks!!


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
load a PDF file with VBA vqthomf Excel Programming 1 April 19th 07 03:45 PM
How do I load a file from URL Peter[_58_] Excel Programming 2 July 27th 06 01:48 PM
File will not load Jack Sheet Excel Discussion (Misc queries) 3 December 4th 04 01:41 PM
Is it possible to load an .xls file Jako[_55_] Excel Programming 2 August 2nd 04 11:29 PM
How to load a help file using VBA Ian[_9_] Excel Programming 2 January 30th 04 02:19 PM


All times are GMT +1. The time now is 10:48 AM.

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

About Us

"It's about Microsoft Excel"