Sie sind vermutlich noch nicht im Forum angemeldet - Klicken Sie hier um sich kostenlos anzumelden Impressum 
Sie können sich hier anmelden
Dieses Thema hat 9 Antworten
und wurde 161 mal aufgerufen
 Skripte und Zusatzprogramme
JoeBu Offline




Beiträge: 213

24.10.2010 22:12
RE: Excel Makro ausführen Zitat · Antworten

Hallo zusammen,

Ich möchte ein Makro in Excel 2007 ausführen lassen. Hierzu habe ich folgenden Skriptbefehl gewählt:

Sub Main
Excel.Application.Run "Testmakro"
End Sub

In Excel habe ich ein Makro mit dem Namen "Testmakro" erstellt.

Ich habe bereits die Object Library von Excel hinzugefügt.
Meiner Meinung nach habe ich auch die Makro Sicherheitsstufe auf die niedrigste mögliche gesetzt (im Vertrauencenter: alle Makros erlauben). Trotzdem bekomme ich folgende Fehlermeldung:

Wie kann ich das Makro zum Laufen bekommen?

Mit freundlichen Grüßen

Jörg

Angefügte Bilder:
Aufgrund eingeschränkter Benutzerrechte werden nur die Namen der Dateianhänge angezeigt Jetzt anmelden!
 f12t318p1877n58.jpg 
monkey8 Offline



Beiträge: 315

24.10.2010 22:47
#2 RE: Excel Makro ausführen Zitat · Antworten

Jörg

There are several ways to do this, the easiest is just to assign a hotkey combination to your Excel macro and then call that hotkey combination with a dragon script. Alternatively just copy the code from your Excel macro and put it in a dragon advanced script like so:

Sub Main
Dim objExcel As Object
Set objExcel = GetObject(, "Excel.Application")

... (insert Excel VBA code here)…

Set objExcel = Nothing
End Sub

Lindsay

JoeBu Offline




Beiträge: 213

29.10.2010 21:30
#3 RE: Excel Makro ausführen Zitat · Antworten

Hello Lindsay,

thanks for your advise. In some cases I can´t work with the easy way. e.g an Excel-makro is write-procted and without hotkey.

How do I can I start an Excel-makro just calling the name of the Excel-Makro?

Kind regards

Jörg

R.Wilke Offline



Beiträge: 6.334

29.10.2010 22:15
#4 RE: Excel Makro ausführen Zitat · Antworten

Jörg,

I am afraid that Lindsay is a bit busy at the moment. I will have to admit that somehow I have never managed to run an Excel or Word macro from inside Dragon the way you are asking about, but always used the hotkey approach which is rather straighforward. I am not even sure if it works at all, and I don't know how if it does.

If you cannot assign a hotkey to the macro, could you start the macro in Excel using keystrokes instead, like using the menus for instance? If so, you could write a script mimicking the keystrokes.

Rüdiger

_______________________________________

Dragon Professional 16 auf Windows 10 Pro und Windows 11
SpeechMike Premium (LFH3500); Office 2019 Pro + Office 365 (monatliches Abo)
HP ZBook Fury 17 G8 - i7-11800H - 24 MB SmartCache - 32 GB RAM - 1 TB SSD

monkey8 Offline



Beiträge: 315

29.10.2010 23:23
#5 RE: Excel Makro ausführen Zitat · Antworten

Jörg,

Thanks Rüdiger for covering my neglected duties. I wish I could offer you a better reply but here's the situation as far as I know.

First of all I must say that I am not a prolific user of Microsoft Office macros, with Microsoft Word you can call a macro in various ways including the very simplistic Application.Run, you can even call it with an active accessibility command if it is on a menu of the UI. However with Excel you need to follow either of the procedures mentioned above. If you are unable to assign a hotkey have you tried the second option of copying the Excel macro into the position specified? Unfortunately I don't know any other way of doing it but I don't understand why you can't get at least the second option to work.

Incidentally Application.Run for some reason does not work and has never claimed to work with Excel, sorry I don't know the exact details.

Lindsay

JoeBu Offline




Beiträge: 213

29.10.2010 23:54
#6 RE: Excel Makro ausführen Zitat · Antworten

Hello Rüdiger, hello Lindsay,

thanks a lot for your support. Now I am able to open writeprocted excel makros with using keystrokes.

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

I am starting using Excel with DNS. Hopefully it will work.

I havn't tried the second option of copying the Excel macro into the position specified in order I do not know the code of these writeprotected macros.
On the other side I prefer to write Excel-Makros directly in Excel. So they can be shared with others not using DNS.

Kind regards

Jörg

R.Wilke Offline



Beiträge: 6.334

30.10.2010 00:11
#7 RE: Excel Makro ausführen Zitat · Antworten

That's what I was thinking of. You might turn that into a list command, the list containing the names of the macros, so you won't have to write a dedicated command for each macro, but just one, and just update the list if you add a new one.

I think Lindsay will be happy to show you how.

Rüdiger

_______________________________________

Dragon Professional 16 auf Windows 10 Pro und Windows 11
SpeechMike Premium (LFH3500); Office 2019 Pro + Office 365 (monatliches Abo)
HP ZBook Fury 17 G8 - i7-11800H - 24 MB SmartCache - 32 GB RAM - 1 TB SSD

JoeBu Offline




Beiträge: 213

31.10.2010 23:55
#8 RE: Excel Makro ausführen Zitat · Antworten

Hello Rüdiger,

thanks for your last advice. The DNS-macro works for several Excel macros now.(German language settings)

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

Kind regards

Jörg

R.Wilke Offline



Beiträge: 6.334

31.10.2010 23:58
#9 RE: Excel Makro ausführen Zitat · Antworten

Hello Jörg

Good job!

Rüdiger

_______________________________________

Dragon Professional 16 auf Windows 10 Pro und Windows 11
SpeechMike Premium (LFH3500); Office 2019 Pro + Office 365 (monatliches Abo)
HP ZBook Fury 17 G8 - i7-11800H - 24 MB SmartCache - 32 GB RAM - 1 TB SSD

Dragon-User Offline



Beiträge: 129

22.12.2010 07:23
#10 RE: Excel Makro ausführen Zitat · Antworten

Hi liebe Forenmitglieder,

ich arbeite seit längerem mit einem Dragon-Makro für eine Anwendung auf der Grundlage von Excel.

Hierbei werden Kommas angepasst, es wären aber auch andere Anpassungen denkbar.
Hier mal das Makro:


Sub Main
Dim oData As New DataObject
Dim strObjekt As String
Dim strSuch As String
Dim strErsatz As String
Dim z As Integer

SendKeys "^{a}"
SendKeys "^{x}", 1

oData.GetFromClipboard
strObjekt = oData.GetText

strSuch = ","
strErsatz = ", "
strObjekt = Replace(strObjekt, strSuch, strErsatz)

oData.SetText strObjekt
oData.PutInClipboard

SendKeys ("^{v}")
End Sub

Es wurden folgende Referenzen gesetzt:
#Reference {00020905-0000-0000-C000-000000000046}#8.3#0#C:ProgrammeMicrosoft OfficeOFFICE11MSWORD.OLB#Microsoft Word 11.0 Object Library
'#Reference {00020813-0000-0000-C000-000000000046}#1.5#0#C:ProgrammeMicrosoft OfficeOFFICE11EXCEL.EXE#Microsoft Excel 11.0 Object Library
'#Reference {0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0#C:WINDOWSsystem32FM20.DLL#Microsoft Forms 2.0 Object Library


Das Ganze arbeitet über das Clipboard, so dass der Benutzer den Befehl sagt, der Text wird eingelesen, im Hintergrund angepasst und wieder eingefügt.

Ich denke, dass dies dem Einen oder Anderen hilfreich sein könnte und poste dies hier, da mir dieses Forum dankenswerterweise auch schon hilfreiche Denkanstösse geliefert hat.

Greetz
DragonUser

DNS 14 Legal - DNS MedicalPE 13 - Win7/64 - Intel Core i5 @ 2,4GHz - 4 GB RAM

Ähnliche Themen Antworten/Neu Letzter Beitrag⁄Zugriffe
Diktierfenster öffnet sich durch Taste „D“
Erstellt im Forum Fragen zur Anwendung von MaFe1
2 05.03.2024 15:20
von max.flinter • Zugriffe: 203
Word-Makros funktionieren immer wieder einmal nicht.
Erstellt im Forum Skripte und Zusatzprogramme von rc.otto
2 13.03.2023 08:05
von rc.otto • Zugriffe: 168
Befehlsausführung in Anwaltssoftware beschleunigen
Erstellt im Forum Fragen zur Anwendung von cptnemo
1 08.03.2023 13:05
von Marius_ • Zugriffe: 203
Wie unter Dragon 16 und MS 365 Skriptbefehle mit Word-VBA-Makros?
Erstellt im Forum Skripte und Zusatzprogramme von Marius_
4 14.03.2023 11:33
von Marius_ • Zugriffe: 348
E-mail - WhatsApp - Google
Erstellt im Forum Fragen zur Anwendung von Jack-The-Ripper
6 30.01.2023 16:04
von Marius_ • Zugriffe: 213
Dragon Excel Datum
Erstellt im Forum Fragen zur Anwendung von Flo_B.
2 29.09.2022 13:19
von Marius_ • Zugriffe: 210
Formatierung in Word 2019
Erstellt im Forum Fragen zur Anwendung von Gilby2000
1 22.01.2022 15:41
von Marius_ • Zugriffe: 280
Excel-Makros ansprechen
Erstellt im Forum Fragen zur Anwendung von ChristianBucher
3 10.11.2021 18:21
von P.Roch • Zugriffe: 186
Microsoft Word per Sprachbefehl starten
Erstellt im Forum Fragen zur Anwendung von STAHL
5 07.04.2021 11:25
von STAHL • Zugriffe: 489
 Sprung  
Xobor Ein Kostenloses Forum | Einfach ein Forum erstellen
Datenschutz