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
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")
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
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.
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.
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
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
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