How can I filter a pivot table with two combo boxes and subsequently open the corresponding PDF file?

AKing_1st

New Member
Joined
Jan 8, 2021
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,
I'm working on a dashboard on Excel 365, in which I would like to learn how to add two combo boxes which should filter a Pivot Table, named "Notes" and placed in a Sheet also named "Notes"... Basically, this pivot table shows the name of the products, their respective operations and their eventual notes. I made two slicers which show the name of the products and the operations, but being a beginner with VBA I just can't make them two combo boxes... What I would like to accomplish is having the possibility to fill the first combo box to find the name of the product and having as a result the operations needed in the second combo box.

Also, if it is possible, I would like to make a button which, if pressed, opens a PDF file whose name is composed by the product's name and its operations (e.g. "Product Name_OP. 10-20").
Since the pivot table contains both the "analyzed" and "to be analyzed" products, I wander if it's better to save the PDF files in just one folder or maybe in two ("Analyzed" and "To be Analyzed"). What do you think about it?

Here's the link to my file: Dashboard Example.xlsx

I hope I expressed myself well. Please tell me if you don't understand something, I'll try to reformulate.
Thank you very much in advance!
 

Some videos you may like

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

ranman256

Well-known Member
Joined
Jun 17, 2014
Messages
1,957
'add the NativeApp code to a module ,then call it:

vDir = "\\server\pdf files\"
vFile = vDir & cboProd & "." & cboOP & ".pdf"

openNativeApp vFile



Code:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpszOp As String, ByVal lpszFile As String, ByVal lpszParams As String, ByVal lpszDir As String, ByVal FsShowCmd As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Const SW_SHOWNORMAL = 1
Const SE_ERR_FNF = 2&
Const SE_ERR_PNF = 3&
Const SE_ERR_ACCESSDENIED = 5&
Const SE_ERR_OOM = 8&
Const SE_ERR_DLLNOTFOUND = 32&
Const SE_ERR_SHARE = 26&
Const SE_ERR_ASSOCINCOMPLETE = 27&
Const SE_ERR_DDETIMEOUT = 28&
Const SE_ERR_DDEFAIL = 29&
Const SE_ERR_DDEBUSY = 30&
Const SE_ERR_NOASSOC = 31&
Const ERROR_BAD_FORMAT = 11&

Public Sub OpenNativeApp(ByVal psDocName As String)
Dim r As Long, msg As String
r = StartDoc(psDocName)
If r <= 32 Then
'There was an error
Select Case r
Case SE_ERR_FNF
msg = "File not found"
Case SE_ERR_PNF
msg = "Path not found"
Case SE_ERR_ACCESSDENIED
msg = "Access denied"
Case SE_ERR_OOM
msg = "Out of memory"
Case SE_ERR_DLLNOTFOUND
msg = "DLL not found"
Case SE_ERR_SHARE
msg = "A sharing violation occurred"
Case SE_ERR_ASSOCINCOMPLETE
msg = "Incomplete or invalid file association"
Case SE_ERR_DDETIMEOUT
msg = "DDE Time out"
Case SE_ERR_DDEFAIL
msg = "DDE transaction failed"
Case SE_ERR_DDEBUSY
msg = "DDE busy"
Case SE_ERR_NOASSOC
msg = "No association for file extension"
Case ERROR_BAD_FORMAT
msg = "Invalid EXE file or error in EXE image"
Case Else
msg = "Unknown error"
End Select
' MsgBox msg
End If
End Sub
 

AKing_1st

New Member
Joined
Jan 8, 2021
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Hello @ranman256 and, first of all, thank you very much for your reply!
Sadly I'm still a beginner and I surely made a mistake while inserting your code.
Would it be a problem if I asked you to update my file for me, please? In that case I would be able to understand where my mistake is and would hopefully learn something. ;)
 

AKing_1st

New Member
Joined
Jan 8, 2021
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Hello everyone.
I'm sorry for bumping, but I still hope somebody could help me.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,281
Messages
5,600,720
Members
414,401
Latest member
grenona2020

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
Top