Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Open file from Cell

Hello

What I am looking to do is give the end-user an option to open a file by typing in the file name in a specific cell (say b10:) My end-users deal with creating and referencing contracts. So, if they need to open a contract, all they would have to do is type in the contract # (which is the file name) and have it opened. Is this possible to do with a user-form or somehow create a macro from this. All the contracts are located on a share drive, but they are saved in different folders. Is it possible to have the macro search all folders for this file or would they all have to be under one folder?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Open file from Cell

look at the help on the filesearch object. You could trigger that on the
worksheet_change event, testing for the entry cell. Then if it is found,
open it.

You can also use Dir or the scripting runtime library (filesystem object).
Having all files in a single directory would make things simpler, but isn't
essential.

--
Regards,

Tom Ogilvy


"Brad" wrote in message
...
Hello,

What I am looking to do is give the end-user an option to open a file by

typing in the file name in a specific cell (say b10:) My end-users deal with
creating and referencing contracts. So, if they need to open a contract, all
they would have to do is type in the contract # (which is the file name) and
have it opened. Is this possible to do with a user-form or somehow create a
macro from this. All the contracts are located on a share drive, but they
are saved in different folders. Is it possible to have the macro search all
folders for this file or would they all have to be under one folder?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Open file from Cell

Hi Brad,

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B10")) Is Nothing Then
With Target
Workbooks.Open Filename:=.Value
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

To input this, right-click on the sheet tab, select View Menu from the menu,
and paste the code in.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Brad" wrote in message
...
Hello,

What I am looking to do is give the end-user an option to open a file by

typing in the file name in a specific cell (say b10:) My end-users deal with
creating and referencing contracts. So, if they need to open a contract, all
they would have to do is type in the contract # (which is the file name) and
have it opened. Is this possible to do with a user-form or somehow create a
macro from this. All the contracts are located on a share drive, but they
are saved in different folders. Is it possible to have the macro search all
folders for this file or would they all have to be under one folder?


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
Open file from address in a cell David P. Excel Discussion (Misc queries) 1 December 18th 07 03:01 PM
open file by inputting file name in cell? Roger Abbot Excel Discussion (Misc queries) 1 September 15th 07 02:38 PM
when i try to open the file it show too many different cell forma. too many cell formats Excel Worksheet Functions 1 March 9th 07 11:53 AM
In Excel - Use Windows Explorer instead of File Open to open file KymY Excel Discussion (Misc queries) 1 August 5th 06 09:59 PM
can not open excel file, too many different cell formats Abdur Excel Discussion (Misc queries) 1 March 17th 05 12:13 PM


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