Macro using SendKeys

Folks,
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?
0
Frank FreeseAuthor Commented:
I tried that and nothing was recorded.
I'm "thinking" this will work?

Sub UpdatePivot()

SendKeys "%{F5}"

End sub
0
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?
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

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!?
0
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?
0
Martin LissOlder than dirtCommented:
This refers to the 1st pivot table on the sheet.

ActiveSheet.PivotTables(1).Name
0

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
0
Frank FreeseAuthor Commented:
thank you kindly sir
0
Martin LissOlder than dirtCommented:
YW U2
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.