View Single Post
 
Old 10-09-2020, 05:58 AM
Userx Userx is offline Windows 10 Office 2019
Novice
 
Join Date: Oct 2020
Posts: 1
Userx is on a distinguished road
Default Need to copy specific formated text from Word and paste from clipboard into a console application

I need to copy lines of text based on the color of the characters, one paragraph at a time. Then I need to paste these lines or group of lines into an external program using VBA macro in Word.

I have this VBA code that I have been experimenting with that pipes the lines to the application via StdIn/StdOut but it doesn't seem very reliable and its not user friendly.

Code:
Sub AutoMop()
'
' AutoMop Macro
'
'
Set wShell = VBA.CreateObject("WScript.Shell")
Set oExec = wShell.Exec("C:\Users\lxpot\Coriant\7191CS\PuTTY\plink.exe aaTest -pw user.778")

' Write to the input stream
oExec.StdIn.Write "service ssh status" & vbCrLf


' The output stream can be shown to the user, e.g.
sOutput = oExec.StdOut.Readall()
MsgBox (sOutput)
As you can see I am able to start an external program and send commands. Now I just need to copy and paste. Any suggestion of examples of what I can do?
Reply With Quote