Mac vba open pdf

leopurcell

New Member
Joined
Aug 14, 2020
Messages
1
Office Version
  1. 365
  2. 2019
Platform
  1. MacOS
Excel 2019 for Mac
want to run a macro where pressing a button opens a PDF file.
at the moment, script manages to locate folder and opens a new window with contents, but does not sect and open the PDF file.
have been playing around with it as it used to work on windows, but no luck as of yet.

Sub open_file()
Dim file_to_open, chemin, file_name As String
Dim find_file As Range
On Error GoTo errorHandler

file_to_open = selection.Value
Set find_file = Sheets("Invoices").Columns(3).Find(file_to_open, LookAt:=xlWhole)
If find_file Is Nothing Then
MsgBox ("File not existing in the Invoices database.")
Else
file_name = find_file.Offset(0, 10)
chemin = "/user/_INVOICES/_" & find_file.Offset(0, 7) & Application.PathSeparator & file_name
ThisWorkbook.FollowHyperlink chemin
End If
Exit Sub
errorHandler:
MsgBox (chemin & " ---- File not existing in the Invoices database...")
End Sub
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,214,983
Messages
6,122,591
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top