View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
NickHK[_3_] NickHK[_3_] is offline
external usenet poster
 
Posts: 415
Default Writing to Notepad from VBA

Stuart,
If the editor is not open, you can't write to it.
So, write to a file:

Dim FF As Long
FF = FreeFile
Open "C:/TextFile.txt" For Output As #FF
Print #FF, "Some Text"
'or a Value from the WS
Print #FF, Range("A1").Value
Close #FF

NickHK

"stuart" ...
It can write to the text editor and after it's finished I can then see
what
has been written. The editor doesn't need to be open during the task.

Thanks.

"NickHK" wrote:

Stuart,
What I mean, you you have to write an open text editor program directly
or
is creating a text file on the system that you later open in Textpad (or
whatever) OK ?
The second option is prettyy straightforward ; check out the Open
statement
in VBA help.
The first option would be more convoluted, unless it's Word.

NickHK

"stuart" ...

NickHK,

It can write to any text editor. But I only have Notepad, Wordpad and
Word
on my PC.

Thanks.

"NickHK" wrote:

Stuart,
Do you mean actually write to the Notepad app, or just write a text
file
?

NickHk

"stuart" ...

Hi,

I'm writing a macro using VBA in Excel and to get the output from
the
macro
to be written in Notepad rather than an Excel worksheet. How do I do
this,
if
it's at all possible?

Thanks.