Macro using SendKeys

I know of several ways to refresh data in a pivot table. The one I am interested in doing is a macro using SendKeys, "Alt + F5". Possible?
Frank FreeseAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
What happens if you record a macro while doing it manually, undoing the change and then running the macro?
Frank FreeseAuthor Commented:
I tried that and nothing was recorded.
I'm "thinking" this will work?

Sub UpdatePivot()

SendKeys "%{F5}"

End sub
Martin LissOlder than dirtCommented:
Sure but (and I don't know much about pivot tables) would you need to add code to select the table?
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

Frank FreeseAuthor Commented:
All the user has to do is click on the pivot table. I don't know how to select a pivot table vba, yet!?
Frank FreeseAuthor Commented:
I can select a pivot table using vba - but the pivot table name would have to remain static and I'm not sure how that's going to hold up?
Martin LissOlder than dirtCommented:
This refers to the 1st pivot table on the sheet.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Frank FreeseAuthor Commented:
thanks Martin
Have a Happy Thanksgiving
Frank FreeseAuthor Commented:
thank you kindly sir
Martin LissOlder than dirtCommented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.