[ 初めての方へ | 一覧(最新更新順) | 全文検索 | 過去ログ ]
『同一フォルダ内のPDFファイルを全て印刷するVBAについて』(Ken)
同じフォルダ内のPDFファイルを全て印刷するVBAについて「オートメーションエラーです。指定されまファイルが見つかりません」とエラーがでます。改善方法について教えてください。
Sub pdfprint( )
Dim strshellcommand as string
Dim myfile as string
Dim wshShellObj As IWshRuntimeLibrary.WshShell
Set wshShellObj = New IWshRuntimeLibrary.WshShell
Myfile=Dir (thisworkbook.path&"\" &" *.pdf")
Do until myfile =""
Strcommand="AcroRD32/p/h"& thisworkbook& "\" & myfile
wshShellObj.Run(Strcommand)←ここでエラー
Myfile =Dir ()
Loop
Wshshell obj=nothing
End sub
< 使用 Excel:Excel2010、使用 OS:Windows10 >
Debug.print Strcommand
などとして、文字列の中身を見てみたらどうですか?
それを
「ファイル名を指定して実行」に貼り付けて、動くかどうかです。
(渡辺ひかる) 2019/11/14(木) 12:17
>Strcommand="AcroRD32/p/h"& thisworkbook& "\" & myfile
Strcommand="AcroRD32/p/h "& thisworkbook.path & "\" & myfile
というオチ? (渡辺ひかる) 2019/11/14(木) 12:21
[ 一覧(最新更新順) ]
YukiWiki 1.6.7 Copyright (C) 2000,2001 by Hiroshi Yuki.
Modified by kazu.