Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBS Script - Paste into Notepad

Status
Not open for further replies.

useractive

Programmer
Jun 21, 2001
98
US
What would be the vbs script line to paste something in notepad?

THanks,
Swish
 
I don't know, but do you really need to do this? Why not write a VB script that pastes something into MS-Word instead and then saves as text?

-Venkman
 
Assuming you don't have MS-Word ;)

Reading from the Clipboard:
There's a clipboard object in Internet Explorer that should be usable. Something like:

Set oHtml = CreateObject("htmlfile")
sClipText = oHtml.ParentWindow.ClipboardData.GetData("text")
WScript.Echo sClipText

Adding it to Notepad:
I'm not sure about opening notepad and dumping data into it, but you could write the data to a sequential file (.txt) and then shell to notepad.
Again, something like:

Dim oWSHShell

' create Shell object instance for Run method
Set oWSHShell = WScript.CreateObject("WScript.Shell")

' shell out a command to Open Notepad
oWSHShell.Run "Notepad " _
& """" & FilePathAndName & """" ,_
1, true


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top