View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Control Notepad from Excel

The open/print#/close stuff writes to a plain old text file.

That's what NotePad uses.

Option Explicit
Sub testme()

Dim myFileName As String
Dim FileNum As Long

myFileName = "C:\my documents\excel\outfile.txt"

FileNum = FreeFile
Close FileNum
Open myFileName For Output As FileNum

Print #FileNum, "Here's some text"
Print #FileNum, "from A1: " & ActiveSheet.Range("a1").Text

Close FileNum
End Sub

Try this little example to see if it works (open the output file in NotePad).

Here are three sites that you could steal some code from:

Earl Kiosterud's Text Write program:
www.smokeylake.com/excel
(or directly: http://www.smokeylake.com/excel/text_write_program.htm)

Chip Pearson's:
http://www.cpearson.com/excel/imptext.htm

J.E. McGimpsey's:
http://www.mcgimpsey.com/excel/textfiles.html

Pete wrote:

Juan

It really does need to be in a notepad format. I have a
Notepad file .csv that is required to control another
program, or the other program (Visual Basic) is writen to
look for this file in order to perform the funtions
needed.

I have up update this notepad file everyweek and send
this off to 200 sales rep around the country. If they
don't install this notepad file in their PC their sales
reporting tools will not work.

Thanks
Pete
-----Original Message-----
You don't need Notepad to do that. You can do that by

using VBA's builtin
commands, like Open, Print # (or Write #), Close, etc.

--
Regards

Juan Pablo González

"Pete" wrote in

message
...
Does anyony know if it is possible to open a note pad
file from excel, enter in some information (All Text)
save the file as a specific name in a specific

directory
on the users PC.

Basically what I want to do is this
Open notepad
write some text
save file as "something" in "somewhere"
close notepad
close excel
End

Any help would be appreciated.
Thanks
Pete



.


--

Dave Peterson