Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Open Text File in Excel

I have a text file called Names.txt (stored at G:\Employees\Names.txt) that I
use to populate a combo box in an Excel form. The last choice in this list is
"-Name Not Listed-". I instruct the users of the form to choose this if the
desired employee name is not listed and click OK.

Upon clicking OK, my code currently checks to see if that choice was made.
If it is, I want the Names.txt text file to open (in Notepad) so that they
can add the name so it's available next time they use the form. I'm
struggling with the code that will open the file in Notepad. Thanks!
--
Steve C
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Open Text File in Excel

Try:

Shell "G:\Employees\Names.txt"

That should open the file in the machine's default text editor.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Open Text File in Excel

Sub opennotepad()
returnedvalue = Shell("C:\WINDOWS\notepad.exe \G:\Employees\Names.txt", 1)
End Sub

"Steve C" wrote:

I have a text file called Names.txt (stored at G:\Employees\Names.txt) that I
use to populate a combo box in an Excel form. The last choice in this list is
"-Name Not Listed-". I instruct the users of the form to choose this if the
desired employee name is not listed and click OK.

Upon clicking OK, my code currently checks to see if that choice was made.
If it is, I want the Names.txt text file to open (in Notepad) so that they
can add the name so it's available next time they use the form. I'm
struggling with the code that will open the file in Notepad. Thanks!
--
Steve C

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Open Text File in Excel

oops typo

returnedvalue = Shell("C:\WINDOWS\notepad.exe G:\Employees\Names.txt", 1)

"Mike" wrote:

Sub opennotepad()
returnedvalue = Shell("C:\WINDOWS\notepad.exe \G:\Employees\Names.txt", 1)
End Sub

"Steve C" wrote:

I have a text file called Names.txt (stored at G:\Employees\Names.txt) that I
use to populate a combo box in an Excel form. The last choice in this list is
"-Name Not Listed-". I instruct the users of the form to choose this if the
desired employee name is not listed and click OK.

Upon clicking OK, my code currently checks to see if that choice was made.
If it is, I want the Names.txt text file to open (in Notepad) so that they
can add the name so it's available next time they use the form. I'm
struggling with the code that will open the file in Notepad. Thanks!
--
Steve C

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Open Text File in Excel

Thanks for the help!
--
Steve C


"Mike" wrote:

oops typo

returnedvalue = Shell("C:\WINDOWS\notepad.exe G:\Employees\Names.txt", 1)

"Mike" wrote:

Sub opennotepad()
returnedvalue = Shell("C:\WINDOWS\notepad.exe \G:\Employees\Names.txt", 1)
End Sub

"Steve C" wrote:

I have a text file called Names.txt (stored at G:\Employees\Names.txt) that I
use to populate a combo box in an Excel form. The last choice in this list is
"-Name Not Listed-". I instruct the users of the form to choose this if the
desired employee name is not listed and click OK.

Upon clicking OK, my code currently checks to see if that choice was made.
If it is, I want the Names.txt text file to open (in Notepad) so that they
can add the name so it's available next time they use the form. I'm
struggling with the code that will open the file in Notepad. Thanks!
--
Steve C

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
Excel open file as text [email protected] New Users to Excel 1 December 12th 09 01:34 AM
open text file in excel George Applegate[_2_] Excel Worksheet Functions 2 April 22nd 08 04:46 AM
Excel VBA - open text file, replace text, save file? Cybert Excel Programming 2 October 2nd 04 01:05 AM
Open two text file in Excel Eric[_6_] Excel Programming 1 February 5th 04 09:39 PM
Open delimited text file to excel without changing data in that file zohanc Excel Programming 1 October 3rd 03 01:06 AM


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

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"