LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Getting user to enter file name

Hi Guys,

I happen to come across this codes from www.exceltip.com. I am
wondering whether is there a way to create a user form that can prompt
user to enter or select the name of the file of th e closed workbook
and worksheet that we they want to get the data from. The following is
the code that will get value from a closed workbook. But the problem is
that the file name of the closed workbook and worksheet is hard coded.
What i need is for the user to enter those information. I hope someone
can hel me out in this.

Sub test()
GetValuesFromAClosedWorkbook "C:", "Book1.xls", _
"Sheet1", "A1:K30"
End Sub

Sub GetValuesFromAClosedWorkbook(fPath As String, _
fName As String, sName, cellRange As String)
With ActiveSheet.Range(cellRange)
.FormulaArray = "='" & fPath & "\[" & fName & "]" _
& sName & "'!" & cellRange
.Value = .Value
End With
End Sub

 
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
Enter a User Name When Changes are Made chickalina Excel Worksheet Functions 4 July 30th 08 05:05 PM
enter user in cell pbs Excel Worksheet Functions 1 July 30th 07 11:26 PM
User must enter something in a range of cells Jugglertwo Excel Discussion (Misc queries) 4 July 27th 06 05:36 AM
Macro to have user enter new worksheet name MMH Excel Programming 2 July 14th 05 01:27 AM
Do combobox allow user to enter text? Daniel[_14_] Excel Programming 0 September 1st 04 09:07 AM


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