macro with user input

scottc_00

New Member
Joined
Feb 14, 2006
Messages
13
I have several excel tools that use pivot tables to get and process data from Access. THese tools have multiple (many) pivot tables. This becomes a burden when I need to refresh the data in the pivot tables. so I use the macro

Sub Refresh_All_PT_WS() 'Refresh all pivot tables active worksheet
Dim pt As PivotTable
For Each pt In ActiveSheet.PivotTables
pt.RefreshTable
Next pt
End Sub

and it works great. However my data is password protected (in Access) so once I start the macro it asks me to input the password for every table as it updates.

NOw the question...Does anyone know a way to use an input box to ask for the password once when the macro starts (simple enough) and use it throughout the macro as it loops and apply it when the password box appears (the hard part)? Alternately since this macro is only in my "PERSONAL" workbook is there a way to insert the password directly into the macro loop (without user input) so it is applied automatically each time the request appears?

Thanks
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
If you are using the pivot table with external data, is there a reason you cannot check the Pivot Table options - save password under external data options?
 
Upvote 0
hmmm...upon further review...this method apparently poses an unacceptable security risk. While investigating this option I learned that, "...This option saves the password as readable text..." not exactly sure where it saves it yet but I can't have this password readable. The actual file is also password protected so i am not worried about others refreshing the data as they cant save the file anyway but I can not give them access to the raw data.

Looks like i am back to the drawing board as far as a macro option needed.

Thanks anyway.
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,269
Members
452,628
Latest member
dd2

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