# Executing external Visual Basic Commands...

**URL:** <https://forum.servoy.com/t/executing-external-visual-basic-commands/2689>\
**Category:** Classic Servoy\
**Created:** [September 10, 2004, 5:20pm UTC](https://forum.servoy.com/t/executing-external-visual-basic-commands/2689 "2004-09-10T17:20:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Providence1](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@Providence1](https://forum.servoy.com/u/Providence1)\
**Post date:** [September 10, 2004, 5:20pm UTC](https://forum.servoy.com/t/executing-external-visual-basic-commands/2689/1 "2004-09-10T17:20:45Z")

</div>

How do I execute/pass an eternal visual basic command/argument like:

.Documents.Add  
.Selection.Paste

I want to copy a global to the clipboard, then launch Word, and paste the clipboard into the new Word document. Here’s my formula:

if(utils.stringMiddle(application.getOSName(),1,7) == “Windows”)  
{  
application.executeProgram(‘C:/Program Files/Microsoft Office/Office/WINWORD.EXE’);  
}

I’m not sure how to pass info to the clipboard (is this the best way?), nor how to execute the command.

Also, the above causes Servoy to wig in different ways. I get a blank (grey) screen instead of the interface to my Servoy app.

Thanks in advance for any advice you have!

Providence

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [September 10, 2004, 7:02pm UTC](https://forum.servoy.com/t/executing-external-visual-basic-commands/2689/2 "2004-09-10T19:02:51Z")

</div>

can’t you make a macro or something like that?

for example winword /mMACRONAME

[http://www.michna.com/kb/WordCommandLineSwitches.htm](http://www.michna.com/kb/WordCommandLineSwitches.htm)

---

<div class="post-metadata">

**Author:** ![Providence1](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@Providence1](https://forum.servoy.com/u/Providence1)\
**Post date:** [September 11, 2004, 1:13am UTC](https://forum.servoy.com/t/executing-external-visual-basic-commands/2689/3 "2004-09-11T01:13:03Z")

</div>

That works! However, the syntax is:

application.executeProgram(‘C:/Program Files/Microsoft Office/Office/WINWORD.EXE’,‘/mMACRONAME’);

In addition, if I try to Command-Tab back to Servoy I get a full utterly blank grey screen! I can’t get rid of it until I quit Word.

Any ideas?

Thanks for all your help!

Providence

---

<div class="post-metadata">

**Author:** ![Jan\_Aleman](https://avatars.discourse-cdn.com/v4/letter/j/4af34b/32.png) [@Jan\_Aleman](https://forum.servoy.com/u/Jan_Aleman)\
**Post date:** [September 11, 2004, 10:06am UTC](https://forum.servoy.com/t/executing-external-visual-basic-commands/2689/4 "2004-09-11T10:06:18Z")

</div>

> Providence1:  
> In addition, if I try to Command-Tab back to Servoy I get a full utterly blank grey screen! I can’t get rid of it until I quit Word.
> 
> Any ideas?
> 
> Thanks for all your help!
> 
> Providence

Use execute in Background (executeProgramInBackground).  
See documentation for details.

---

<div class="post-metadata">

**Author:** ![Providence1](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@Providence1](https://forum.servoy.com/u/Providence1)\
**Post date:** [February 18, 2010, 12:14am UTC](https://forum.servoy.com/t/executing-external-visual-basic-commands/2689/5 "2010-02-18T00:14:02Z")

</div>

Has anyone had any luck passing the following kinds of visual basic commands:

```auto
application.executeProgramInBackground('C:/Program Files/Microsoft Office/OFFICE11/OUTLOOK.EXE'),'Dim olApp As Outlook.Application','Set olApp = CreateObject("Outlook.Application")', 'Dim olMail As Outlook.MailItem', 'Set olMail = olApp.CreateItem(olMailItem)', 'olMail.To = olItem.Email1Address', 'olMail.Subject = "RE:..."'

```

I could have sworn that it worked perfectly in a previous version.

Thanks in advance for any help you can provide

---

<div class="post-metadata">

**Author:** ![Providence1](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@Providence1](https://forum.servoy.com/u/Providence1)\
**Post date:** [March 2, 2010, 4:25pm UTC](https://forum.servoy.com/t/executing-external-visual-basic-commands/2689/6 "2010-03-02T16:25:01Z")

</div>

To ask it another way, launching mailto:? using rundll32.exe url.dll,FileProtocolHandler works, but you get you a new, blank Outlook email window with no signature.

Is there a way to get a signature block when launching a users Outlook app?
