<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Run a Macro in Excel? in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Run-a-Macro-in-Excel/m-p/85679#M36640</link>
    <description>Hi everybody,

Sorry if the question is obvious, I am rather new to BluePrism (and not entirely a VBA expert either). 

I am trying to make the bot run a macro in an Excel sheet. However, I cannot seem to make the code work. Normally I would just use the Application.Run, but in BluePrism I am told that this function is not defined.

Any help as to how I run a macro once worksheet and macro name have been obtained?

Thank you very much and best regards from sunny Denmark,
Christian</description>
    <pubDate>Thu, 16 Jul 2015 16:53:00 GMT</pubDate>
    <dc:creator>Christian_Jense</dc:creator>
    <dc:date>2015-07-16T16:53:00Z</dc:date>
    <item>
      <title>Run a Macro in Excel?</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Run-a-Macro-in-Excel/m-p/85679#M36640</link>
      <description>Hi everybody,

Sorry if the question is obvious, I am rather new to BluePrism (and not entirely a VBA expert either). 

I am trying to make the bot run a macro in an Excel sheet. However, I cannot seem to make the code work. Normally I would just use the Application.Run, but in BluePrism I am told that this function is not defined.

Any help as to how I run a macro once worksheet and macro name have been obtained?

Thank you very much and best regards from sunny Denmark,
Christian</description>
      <pubDate>Thu, 16 Jul 2015 16:53:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Run-a-Macro-in-Excel/m-p/85679#M36640</guid>
      <dc:creator>Christian_Jense</dc:creator>
      <dc:date>2015-07-16T16:53:00Z</dc:date>
    </item>
    <item>
      <title>Hi Christian,</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Run-a-Macro-in-Excel/m-p/85680#M36641</link>
      <description>Hi Christian,
I currently have a process in production that runs macros in Excel. I used the Global Send Keys commands to call the macros in Excel since each macro can be assigned a hot-key command.
Hope that helps.
Justin</description>
      <pubDate>Thu, 16 Jul 2015 17:56:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Run-a-Macro-in-Excel/m-p/85680#M36641</guid>
      <dc:creator>JustinBishop</dc:creator>
      <dc:date>2015-07-16T17:56:00Z</dc:date>
    </item>
    <item>
      <title>Hi Justin,</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Run-a-Macro-in-Excel/m-p/85681#M36642</link>
      <description>Hi Justin,
Thank you, that might just work. Could you explain how I obtain the Global Send Keys commands?
I would prefer to run the macro by name however. If anyone has ideas on how to do this, I would be very happy.
All the best,
Christian</description>
      <pubDate>Thu, 16 Jul 2015 18:03:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Run-a-Macro-in-Excel/m-p/85681#M36642</guid>
      <dc:creator>Christian_Jense</dc:creator>
      <dc:date>2015-07-16T18:03:00Z</dc:date>
    </item>
    <item>
      <title>I found a solution to run a</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Run-a-Macro-in-Excel/m-p/85682#M36643</link>
      <description>I found a solution to run a query and a Saved Import in MS Access. Perhaps this will help with the Excel problem. 
First, I located the dao.dll for Access, downloaded it, and added it to Blue Prism folder. The Excel .dll should be just as available.
C:\Program Files\Blue Prism Limited\Blue Prism Automate
    Microsoft.Office.interop.access.dao.dll
    Microsoft.Office.Interop.Access.dll
In the comment block of the Initialize page of the MS Access – VBO object, I navigated to the Code Options tab. There I checked/added the DLLs to the External References and added namespaces to the Namespace Imports section.
    External References
       Microsoft.Office.Interop.Access.dll
       Microsoft.Office.interop.access.dao.dll
    Namespace Imports
        System
        System.Collections.Generic
        Microsoft.VisualBasic
        System.IO
        System.Runtime.InteropServices
        System.Diagnostics
        Microsoft.Office.interop.access.dao
        System.Data
        System.Data.OLEDB
In the MS ACCESS – vbo object, I created a page (Open Query) with a data item called QueryToOpen, a handle, and a collection to receive the query results.
After checking the instance handle, I crafted a code stage that takes the handle and the QueryToOpen variable and used it in the code section. The code is as follows:
    Dim accessDb As Object = GetInstance(handle)
    accessDb.DoCmd.OpenQuery(QueryToOpen)
Additionally I created another page (Run Saved Imports) with a code stage that uses this code:
    Dim access As Object = GetInstance(handle)
    access.DoCmd.RunSavedImportExport(savedImportToRun)
I hope this helps,
Michael Zimmerman</description>
      <pubDate>Thu, 16 Jul 2015 18:04:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Run-a-Macro-in-Excel/m-p/85682#M36643</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-07-16T18:04:00Z</dc:date>
    </item>
    <item>
      <title>Hi Christian,</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Run-a-Macro-in-Excel/m-p/85683#M36644</link>
      <description>Hi Christian,
At the Object level, use a Navigate stage. The Element will be the top most Element which will be your application. The Action will be ""Global Send Keys"". Your input will be a text command that will look something like ""{CTRL}"". Just replace the ""A"" with your actual hot-key letter assigned in Excel.
Here's a list of commands &lt;A href="http://msdn.microsoft.com/en-us/library/aa248599(v=vs.60).aspx" target="test_blank"&gt;http://msdn.microsoft.com/en-us/library/aa248599(v=vs.60).aspx&lt;/A&gt;.
Have fun!
Justin</description>
      <pubDate>Thu, 16 Jul 2015 18:21:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Run-a-Macro-in-Excel/m-p/85683#M36644</guid>
      <dc:creator>JustinBishop</dc:creator>
      <dc:date>2015-07-16T18:21:00Z</dc:date>
    </item>
    <item>
      <title>Hi Christian,</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Run-a-Macro-in-Excel/m-p/85684#M36645</link>
      <description>Hi Christian,
I almost forgot one important step when using hot keys. When stepping through your process while testing, you MUST play through your send key stage; you cannot step through it. Global Send Key commands require that the application has complete focus. If you step through the send key stage, you are putting the focus back on the BP object page and the hot key will try to run against the BP object, not your application.
I hope that makes sense.
Justin</description>
      <pubDate>Thu, 16 Jul 2015 18:26:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Run-a-Macro-in-Excel/m-p/85684#M36645</guid>
      <dc:creator>JustinBishop</dc:creator>
      <dc:date>2015-07-16T18:26:00Z</dc:date>
    </item>
    <item>
      <title>Hi Justin,</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Run-a-Macro-in-Excel/m-p/85685#M36646</link>
      <description>Hi Justin,
Ah ok. I think that one is called ""Window Press Key"" in my version, hence the confusion. Will work around with it a little bit. I set the shortcut as ""^+{ENTER}"" in Excel, so hopefully that will work :)
Thanks a million for the reply,
Christian</description>
      <pubDate>Thu, 16 Jul 2015 18:41:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Run-a-Macro-in-Excel/m-p/85685#M36646</guid>
      <dc:creator>Christian_Jense</dc:creator>
      <dc:date>2015-07-16T18:41:00Z</dc:date>
    </item>
  </channel>
</rss>

