コードステージでExecWithTimeoutを利用しようとしたところエラーが発生します
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
11-05-20 03:47 AM
お世話になっております。SDBA 鈴木と申します。
ポップアップ表示があるマクロではRun Macroが終了しません。
マクロを修正ぜずに何とかならないかと、
神谷町ブログで以下の記事※を見つけ、これはと思い実装(コピペ)してみました。
※Blue Prism から Excel マクロをタイムアウト時間指定で実行する
https://www.ebocean.work/entry/2020/04/03/190000
コードステージ

しかし、コードステージでチェックコードをしたところ、『ExecWithTimeout' は宣言されていません。保護レベルが原因でアクセスできない可能性もあります。」というエラーが発生します。
ExecWithTimeoutを使うために、DLLを追加する等対応が必要でしょうか。
あるいは、ほかに確認すべき場所があればご教示願います。
------------------------------
takashi suzuki
SE
SANDEN Business Associate
伊勢崎
------------------------------
ポップアップ表示があるマクロではRun Macroが終了しません。
マクロを修正ぜずに何とかならないかと、
神谷町ブログで以下の記事※を見つけ、これはと思い実装(コピペ)してみました。
※Blue Prism から Excel マクロをタイムアウト時間指定で実行する
https://www.ebocean.work/entry/2020/04/03/190000
コードステージ
しかし、コードステージでチェックコードをしたところ、『ExecWithTimeout' は宣言されていません。保護レベルが原因でアクセスできない可能性もあります。」というエラーが発生します。
ページ:Run Macro Timeout ステージ:Run Macro Timeout タイプ:エラー アクション:検証 説明:行1のコンパイラエラー:'ExecWithTimeout' は宣言されていません。保護レベルが原因でアクセスできない可能性もあります。 修理可能:いいえ
ExecWithTimeoutを使うために、DLLを追加する等対応が必要でしょうか。
あるいは、ほかに確認すべき場所があればご教示願います。
------------------------------
takashi suzuki
SE
SANDEN Business Associate
伊勢崎
------------------------------
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
11-05-20 05:01 AM
鈴木様
元にしたExcel VBOが古いため、ExecWithTimeoutがグローバルコードで宣言されていないためだと思われます。
以下をグローバルコードに追加してみて頂くといかがでしょうか?
またはDXから最新のExcel VBOをダウンロードいただき、それを元にしていただいても行けるかなと。
https://digitalexchange.blueprism.com/dx/entry/9648/solution/ms-excel-blue-prism-utility
確認のほど、よろしくお願いいたします。
------------------------------
Satoshi Abe
Blue Prism
------------------------------
元にしたExcel VBOが古いため、ExecWithTimeoutがグローバルコードで宣言されていないためだと思われます。
以下をグローバルコードに追加してみて頂くといかがでしょうか?
またはDXから最新のExcel VBOをダウンロードいただき、それを元にしていただいても行けるかなと。
https://digitalexchange.blueprism.com/dx/entry/9648/solution/ms-excel-blue-prism-utility
' Execute a sub within a specific timeout period ' ' @param timeout The number of seconds to wait before timing out ' @param name The name of the operation ' @param operation The operation to perform Private Sub ExecWithTimeout(timeout As Integer, name As String, operation As Action) Dim ar = operation.BeginInvoke(Nothing, Nothing) If Not ar.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(timeout)) Then Throw New TimeoutException(name & " took more than " & timeout & " secs.") End If operation.EndInvoke(ar) End Sub ' Execute a function within a specific timeout period ' ' @param timeout The number of seconds to wait before timing out ' @param name The name of the operation ' @param operation The operation to perform ' ' @return The result of the operation Private Function ExecWithTimeout(Of T)(timeout As Integer, name As String, operation As Func(Of T)) As T Dim ar = operation.BeginInvoke(Nothing, Nothing) If Not ar.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(timeout)) Then Throw New TimeoutException(name & " took more than " & timeout & " secs.") End If return operation.EndInvoke(ar) End Function
確認のほど、よろしくお願いいたします。
------------------------------
Satoshi Abe
Blue Prism
------------------------------
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
11-05-20 05:56 AM
Blue Prism Abe様
お世話になっております。
迅速なご回答ありがとうございます。
グローバルコードに追加したところエラーが出なくなりました。
ご指摘の通り、古いMS Excel VBOをextendしたものでした。
ありがとうございました。
以上です。よろしくお願いいたします。
------------------------------
takashi suzuki
SE
SANDEN Business Associate
伊勢崎
------------------------------
お世話になっております。
迅速なご回答ありがとうございます。
グローバルコードに追加したところエラーが出なくなりました。
ご指摘の通り、古いMS Excel VBOをextendしたものでした。
ありがとうございました。
以上です。よろしくお願いいたします。
------------------------------
takashi suzuki
SE
SANDEN Business Associate
伊勢崎
------------------------------
