hi experts
I face showing this error ' compile error' in word open in this line
the code should open file from pdf extensions when write in A1
any help to fix it
Code
Private Sub Worksheet_Change(ByVal Target As Range)
Dim searchFolder As String, fileName As String
Dim AcroApp As Acrobat.CAcroApp
searchFolder = "C:\search\files\reports\"
If Right(searchFolder, 1) <> "\" Then searchFolder = searchFolder & "\"
If Target.Address = "$A$1" Then
fileName = Dir(searchFolder & Target.Value & ".pdf")
If fileName <> vbNullString Then
If MsgBox(fileName & " exists. Do you want to open it?", vbYesNo + vbInformation, "Open PowerPoint file?") = vbYes Then
If AcroApp Is Nothing Then Set AcroApp = CreateObject("AcroExch.App")
AcroApp.Open searchFolder & fileName
End If
End If
End If
End Sub
Display More