ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel macro help?? (https://www.excelbanter.com/excel-programming/274247-excel-macro-help.html)

Chris

Excel macro help??
 
Ok, here is what I am trying to do. I have a button which
says "find file". What I want is that when someone clicks
this button, your "open" file box or dialog box pops up
and you can search for the file you want to use. However,
instead of opening the file, it just gives the correct
path of that file. I have a text file that I will be
sending out to people, and they need to save it
somewheres, and then click this "find file" button to
insert that path so another macro can read off of the
location.

I am using Excel 2000, and it is frustrating, this code
works for office xp products, but not with this excel
version:

With Application.FileDialog(msoFileDialogOpen)

.AllowMultiSelect = True
.Show

' Display paths of each file selected
For lngCount = 1 To .SelectedItems.Count
ActiveSheet.Range("I27").Select
Range("I27").Value = .SelectedItems(lngCount)
'MsgBox .SelectedItems(lngCount)
Next lngCount

End With

Any help would be much appreciated!!! Thanks.

Dan E[_2_]

Excel macro help??
 
Chris

FileName = Application.GetOpenFileName

or just for text files

FileName = Application.GetOpenFilename("Text Files (*.txt),*.txt")

FileName will be a string containing a file path

Dan E

"Chris" wrote in message ...
Ok, here is what I am trying to do. I have a button which
says "find file". What I want is that when someone clicks
this button, your "open" file box or dialog box pops up
and you can search for the file you want to use. However,
instead of opening the file, it just gives the correct
path of that file. I have a text file that I will be
sending out to people, and they need to save it
somewheres, and then click this "find file" button to
insert that path so another macro can read off of the
location.

I am using Excel 2000, and it is frustrating, this code
works for office xp products, but not with this excel
version:

With Application.FileDialog(msoFileDialogOpen)

.AllowMultiSelect = True
.Show

' Display paths of each file selected
For lngCount = 1 To .SelectedItems.Count
ActiveSheet.Range("I27").Select
Range("I27").Value = .SelectedItems(lngCount)
'MsgBox .SelectedItems(lngCount)
Next lngCount

End With

Any help would be much appreciated!!! Thanks.




Chris

Excel macro help??
 

Thanks for the help, I will try to work with these.


All times are GMT +1. The time now is 12:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com