KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: how to call an excel macro from Dragon
Topic Summary: VBA to call a macro from excel?
Created On: 04/23/2012 08:32 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 how to call an excel macro from Dragon   - gabor5454 - 04/23/2012 08:32 PM  
 how to call an excel macro from Dragon   - R. Wilke - 04/24/2012 09:14 AM  
 how to call an excel macro from Dragon   - bk82 - 04/24/2012 04:47 PM  
 how to call an excel macro from Dragon   - gabor5454 - 04/24/2012 10:24 PM  
 how to call an excel macro from Dragon   - JoeBu - 04/27/2012 03:20 PM  
Keyword
 04/23/2012 08:32 PM
User is offline View Users Profile Print this message


gabor5454
Junior Member

Posts: 32
Joined: 03/20/2011

I am using dragon pro 11.5 and I want to use an excel macro in a scripted command

I understand the syntax for calling a word macro is word.application.run "macroName"  with a reference set to word (which I am having success with)

Is there a comparable VB line for excel? I have tried a few things and seem to be missing it .

I have tried inserting the VBA code directly (I am using Larry Allen's excellent book) - I can get excel to open and create the workbook as he describes, but when I try pasting the code that works in excel directly into dragon it does not run - It seems easier to simply call the macro that works, if I can.

Thanks in advance

Ricky 

 

to be exact - I want to open a new instance of excel, run the macro, then close excel  - the macro sends its output to the clipboard, so I don't need to save the workbook 

 04/24/2012 09:14 AM
User is offline View Users Profile Print this message

Author Icon
R. Wilke
Top-Tier Member

Posts: 4391
Joined: 03/04/2007

Ricky,

the path of least resistance is to assign a keyboard shortcut to execute the macro from within Excel, and then call the shortcut via Advanced Scripting from Dragon, using a simple SendKeys command.

Rüdiger

 



-------------------------

Well, it's past the point where we can make any changes in the code, but we can still make changes to the Easter Egg!

 04/24/2012 04:47 PM
User is offline View Users Profile Print this message


bk82
Top-Tier Member

Posts: 215
Joined: 08/04/2007

I second that. Executing macros via Advanced Scripting using a reference to Excel or using the "path" to the macro have often resulted in errors. The hotkey solution is the best one.

-------------------------

DNS 12 Pro, Medical, Premium - German, English, French - Dragon Dictate 3.0, dns.comfort


 


Core i7 950, Windows 7 Ultimate 64-bit, Intel Core i7 950, 12 GB RAM, L2 2MB; Mic: Jabra Chromo NC 2400 USB.


 


www.in2comp.ch 

 04/24/2012 10:24 PM
User is offline View Users Profile Print this message


gabor5454
Junior Member

Posts: 32
Joined: 03/20/2011

Thanks - this does work nicely, and is what I had been using from Knowbrainer. I worry a bit about running out of hotkeys as I write more macros, but I guess I can cross that bridge when I come to it. 

Ricky 

 04/27/2012 03:20 PM
User is offline View Users Profile Print this message


JoeBu
New Member

Posts: 7
Joined: 04/27/2012

Hello Ricky,

regarding your worries about running out of hotkeys I propose the following. You will be able to run excel makros with using keystrokes. Even if they are writeprocted. 

First you have to check what are the keystrokes combination to run an excel makro. Press the alt-key and then have a look what is the key-combination.

The german code for Excel 2007 is:

Sub Main
sendkeys"%w" ' acces to the development tool? (Entwicklertools in German)
sendkeys"pm" ' acces to macros
sendkeys"name_of_the_macro"
sendkeys"%a" 'start macro
End Sub

Or

Sub Main
SendKeys"%w"
SendKeys"pm"
SendKeys ListVar1
SendKeys"%a"
End Sub 

kind regards

 Joe



-------------------------

Work: DNS 12 Pro German, Windows 7 64bit, 8GB RAM, Intel i7 Q820


Home: DNS 12 Pro German, Windows 7 64bit, 8GB RAM, Intel Core 2Duo E8400


 





Statistics
27365 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 7 users logged in.
The most users ever online was 2028 on 04/05/2013 at 07:36 PM.
There are currently 88 guests browsing this forum, which makes a total of 95 users using this forum.

FuseTalk Standard Edition v4.0 - © 1999-2013 FuseTalk™ Inc. All rights reserved.