ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   reading contents of a file (https://www.excelbanter.com/excel-programming/301425-reading-contents-file.html)

Christopher Brooks[_3_]

reading contents of a file
 
Hello,

How do I open a file browse window and have my spread
sheet read the contents and write them to a worksheet?

Thanks

Chip Pearson

reading contents of a file
 
Christopher,

Try something like the following:


Dim FName As Variant
Dim WB As Workbook
FName = Application.GetOpenFilename("Excel files ,*.xls")
If FName = False Then
' no file chosen
Exit Sub
End If
Set WB = Workbooks.Open(Filename:=FName)
'
' do something with WB
'

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Christopher Brooks" wrote in
message ...
Hello,

How do I open a file browse window and have my spread
sheet read the contents and write them to a worksheet?

Thanks




Tom Ogilvy

reading contents of a file
 
Dim fname as String
fname = Application.GetOpenFileName
if fname < "False" then
workbooks.open fname
End if

If you are talking about something other than an XLS file, then you would
have to be more specific.

--
Regards,
Tom Ogilvy


"Christopher Brooks" wrote in message
...
Hello,

How do I open a file browse window and have my spread
sheet read the contents and write them to a worksheet?

Thanks





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

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