アプリ版:「スタンプのみでお礼する」機能のリリースについて

Visual Basic 初心者です。
Excelからファイルを検索してPDFを開きたいのですが分かりません。
できればサンプルコードがあれば助かります。
よろしくお願いします。

A 回答 (1件)

ご参考になりますか?



参考URL:http://oshiete1.goo.ne.jp/qa2708439.html

この回答への補足

Dim a As Integer
Dim inbox As String
Dim Localpath As Variant

Dim c As Range, myFadd As String
Dim flag As Variant

Dim MyShell As Object
Dim Mysh As String


Dim newHour As Variant
Dim newMinute As Variant
Dim newSecond As Variant

Dim waitTime As Variant


Localpath = ThisWorkbook.Path


a = 1

inbox = InputBox("ファイル検索")



Do
'On Error GoTo flag

If inbox = Empty Then
Exit Sub
End If




If inbox = Cells(a, 1) Then
MsgBox ("あります")

Exit Do
Else

a = a + 1
'ElseIf Cells(a, 1) <> inbox Then
'MsgBox ("ない")

End If

Loop



Set MyShell = CreateObject("WScript.Shell")


MyShell.Run ("AcroRd32.exe /n")
MyShell.Run ("AcroRd32.exe /p") & Localpath & "\" & Myfile & ".pdf"

newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 10

waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

Application.SendKeys "{Enter}", True
'次の使用例は、10 秒を過ぎるとメッセージを表示します。

If Application.Wait(Now + TimeValue("0:00:10")) Then
MsgBox "時間が過ぎました。"

End If
こんな感じで作ってみたのですが、PDFは開くのですが、ファイルが見つからないとエラーが出てしまうのですが、どうしてでしょうか?
よろしくお願いします。

補足日時:2007/02/21 21:30
    • good
    • 2
この回答へのお礼

ありがとうございました。
参考にさせていただきます。
ちょっと質問内容が分かりにくかったので、再度投稿しなおすことにしました。すいませんでした

お礼日時:2007/02/21 22:19

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!