Hi there!
I am using the code below to refresh all pivots within a file I share to many people.
This file is fed with raw data that is updated weekly. The pivots on this file are derived from the raw data.
As you can see, the code is configured so as to display a message box to alert users when all pivots have been refreshed.
Now I'd like the code to contain a command that would play any of 50 the sounds listed on the .wav files in my C:\Windows\Media folder.
Examples of files:
chimes.wav C:\Windows\Media\chimes.wav
chord.wav C:\Windows\Media\chord.wav
The idea is to have the sound being played once the pivots have been refreshed. In other words, besides having the message box, I'd like to have a sound effect to alert users when all pivots have been refreshed.
Somebody, please, help me out here! I am using Excel 2003.
Thanks!!!
===========================
Sub Refresh_Pivots()
'
' Refresh_Pivots Macro
' Macro recorded 5/5/2013 by alchavar
'
'prevents unused items in non-OLAP PivotTables
'pivot table tutorial by contextures.com
Dim pt As PivotTable
Dim ws As Worksheet
Dim pc As PivotCache
'change the settings
For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.PivotCache.MissingItemsLimit = xlMissingItemsNone
Next pt
Next ws
'refresh all the pivot caches
For Each pc In ActiveWorkbook.PivotCaches
On Error Resume Next
pc.Refresh
Next pc
MsgBox "Done! The pivots have been refreshed!"
End Sub
I am using the code below to refresh all pivots within a file I share to many people.
This file is fed with raw data that is updated weekly. The pivots on this file are derived from the raw data.
As you can see, the code is configured so as to display a message box to alert users when all pivots have been refreshed.
Now I'd like the code to contain a command that would play any of 50 the sounds listed on the .wav files in my C:\Windows\Media folder.
Examples of files:
chimes.wav C:\Windows\Media\chimes.wav
chord.wav C:\Windows\Media\chord.wav
The idea is to have the sound being played once the pivots have been refreshed. In other words, besides having the message box, I'd like to have a sound effect to alert users when all pivots have been refreshed.
Somebody, please, help me out here! I am using Excel 2003.
Thanks!!!
===========================
Sub Refresh_Pivots()
'
' Refresh_Pivots Macro
' Macro recorded 5/5/2013 by alchavar
'
'prevents unused items in non-OLAP PivotTables
'pivot table tutorial by contextures.com
Dim pt As PivotTable
Dim ws As Worksheet
Dim pc As PivotCache
'change the settings
For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.PivotCache.MissingItemsLimit = xlMissingItemsNone
Next pt
Next ws
'refresh all the pivot caches
For Each pc In ActiveWorkbook.PivotCaches
On Error Resume Next
pc.Refresh
Next pc
MsgBox "Done! The pivots have been refreshed!"
End Sub