Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Open Dialog..! in vb code..!

I want to read a CSV file(using Open/Read etc), and parse the file in
code to set certain cell values...

1) How can i use an xlOpenDialog dialog box to allow the user to
select a CSV file
2) Return the name of the selected file into a variable.


I don't want to have to build a userform, and if possible use the
Application.Dialogs(xlOpenDialog) function.
I'm sure ive used this method before, but am unable to find it in my
archives.

Any Feedback is always appreciated.
Thankyou for your time.

Andrew


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Open Dialog..! in vb code..!

Try this...

Dim strFileName As String

strFileName = Application.GetOpenFilename("Text Files (*.csv), *.csv")

--
HTH...

Jim Thomlinson


"Andrew" wrote:

I want to read a CSV file(using Open/Read etc), and parse the file in
code to set certain cell values...

1) How can i use an xlOpenDialog dialog box to allow the user to
select a CSV file
2) Return the name of the selected file into a variable.


I don't want to have to build a userform, and if possible use the
Application.Dialogs(xlOpenDialog) function.
I'm sure ive used this method before, but am unable to find it in my
archives.

Any Feedback is always appreciated.
Thankyou for your time.

Andrew



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Open Dialog..! in vb code..!

Sorry I should have elaborated on why I chose to use GetOpenfilename. You can
use

Application.Dialogs(xlDialogOpen).Show "*.csv"

But that opens the file. It does not return the name to a variable. I assume
you did not intend to open the CSV.
--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

Try this...

Dim strFileName As String

strFileName = Application.GetOpenFilename("Text Files (*.csv), *.csv")

--
HTH...

Jim Thomlinson


"Andrew" wrote:

I want to read a CSV file(using Open/Read etc), and parse the file in
code to set certain cell values...

1) How can i use an xlOpenDialog dialog box to allow the user to
select a CSV file
2) Return the name of the selected file into a variable.


I don't want to have to build a userform, and if possible use the
Application.Dialogs(xlOpenDialog) function.
I'm sure ive used this method before, but am unable to find it in my
archives.

Any Feedback is always appreciated.
Thankyou for your time.

Andrew



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Open Dialog..! in vb code..!

Thanx Jim, did the trick exactly.

"Jim Thomlinson" wrote in
message ...
| Try this...
|
| Dim strFileName As String
|
| strFileName = Application.GetOpenFilename("Text Files (*.csv),
*.csv")
|
| --
| HTH...
|
| Jim Thomlinson
|
|
| "Andrew" wrote:
|
| I want to read a CSV file(using Open/Read etc), and parse the file
in
| code to set certain cell values...
|
| 1) How can i use an xlOpenDialog dialog box to allow the user to
| select a CSV file
| 2) Return the name of the selected file into a variable.
|
|
| I don't want to have to build a userform, and if possible use the
| Application.Dialogs(xlOpenDialog) function.
| I'm sure ive used this method before, but am unable to find it in
my
| archives.
|
| Any Feedback is always appreciated.
| Thankyou for your time.
|
| Andrew
|
|
|


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 Dialog Box to return Selected File Path and Not Open it. DMS Excel Programming 4 January 26th 10 12:46 PM
VBA code to open 3D dialog window Jim Thomlinson Excel Programming 0 September 26th 08 06:11 PM
Code for bring up the file-open dialog box Ben Excel Programming 3 February 10th 06 03:21 AM
Open file with open dialog box Jafery Excel Programming 5 September 12th 05 02:43 PM
control of dialog macro dialog box. on open Gerry Abbott Excel Programming 0 July 22nd 04 05:41 PM


All times are GMT +1. The time now is 09:33 PM.

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

About Us

"It's about Microsoft Excel"