How can I pass some text to display in the body of the new notepad document that gets opened?

Question:

I am using Application.BasicFunctions.DoInvoke “Open”, “(location)” to open notepad (as a test). Is there any way I can pass some text to display in the body of the new notepad document that gets opened?

Answer:

It will be possible if you use the WScript.Shell object for starting notepad:

Option Explicit
Dim strMessage
strMessage = “Hello World” & vbCrLF & “A new line after a carriage return”
Dim wshShell
Set wshShell = CreateObject(“WScript.Shell”)
wshShell.Run “notepad.exe”
WScript.Sleep 200
wshShell.SendKeys (strMessage)
Set wshShell = Nothing

The command “WScript.Sleep 200” is necessary to give “notepad.exe” some time to start and initialize itself before accepting any input. For details have a look at the script56.chm Rescorce of VBScript.

 

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) news and product updates!

You have Successfully Subscribed!