Power Automate for desktop

[Power Automate for desktop]VSTOアドイン内のコードを実行する方法

Power Platform CommunityにPower Automate for desktop(PAD)のフローでExcelのVSTOアドイン内のコードを呼び出したい、との質問がありました。

Hello, I am trying to do the same thing except my macro is stored in a VSTO add-in for Excel which I created in Visual Studio. Can anyone tell me what I should use as the “add-in name” in the Macro field for PAD in this case?

https://powerusers.microsoft.com/t5/Power-Automate-Desktop/How-to-Run-addin-macro-on-an-Excel-by-PAD/m-p/1764658/highlight/true#M17884 より

個人的には、これはアドイン側の実装によるのではないかと思います。
下記Docs資料のように外部から呼び出せる仕様(クラス・インターフェース公開、RequestComAddInAutomationServiceメソッドオーバーライド)であれば下記のようなスクリプトやマクロからアドイン内のメソッドを実行できます。

'実行中のExcelでVSTOアドインのメソッド実行
'対象アドイン:https://docs.microsoft.com/ja-jp/visualstudio/vsto/walkthrough-calling-code-in-a-vsto-add-in-from-vba
Option Explicit

With GetObject(, "Excel.Application")
  Dim addIn: Set addIn = Nothing 'COMAddIn
  On Error Resume Next
  Set addIn = .COMAddIns("ExcelImportData")
  On Error GoTo 0
  If Not addIn Is Nothing Then addIn.Object.ImportData
End With

あるいはこのような仕様になっていなくても、リボンUIから処理を実行できるようになっているのであれば、UIオートメーションを使うことでも対応できるでしょう。

下記は選択ダイアログによってスクリプトによる実行とUIオートメーションによる実行を切り替えるサンプルです。

今となってはVSTOアドインの処理をPADから実行する機会もそう無いとは思いますが、上記のように一応実行できることを覚えておいても損は無いでしょう。

[Office Scripts]日付印を作成する方法前のページ

【感想】特別展「化石ハンター展」に行ってきたよ(2)次のページ

関連記事

  1. Power Automate for desktop

    「はじめてのPower Automate Desktop」レビュー

    以前書いた記事でも紹介していますが、株式会社ASAHI Account…

  2. Power Automate for desktop

    [Power Automate for desktop]カスタム アクションの入力パラメーターでファ…

    久しぶりのブログ更新です。今回はタイトルの通りPower Auto…

  3. Power Automate for desktop

    Power Automate for desktopのアクション一覧

    Power Automate for desktopのアクションペイン…

  4. Power Automate for desktop

    [Power Automate for desktop]他ブックのマクロを実行する方法

    2022年1月のアップデートで、「Excel の起動」アクションでEx…

コメント

  • コメント (0)

  • トラックバックは利用できません。

  1. この記事へのコメントはありません。

Time limit is exhausted. Please reload CAPTCHA.

※本ページはプロモーションが含まれています。

Translate

最近の記事

アーカイブ

PAGE TOP