PDA

View Full Version : HELP! - Print All Options (Loop) On A Drop Down List after Refreshing Excel Add In



nate17
05-28-2019, 10:11 PM
I have a report that my team has to log into an Excel Add In, change selection in drop down list, Refresh Excel Add In and print off (or save to pdf), then repeat until all selections have been refreshed and printed.
It should be noted that refreshing the data can take some time for each selection therefore the code must be able to be 'patient' enough for the process to properly refresh and print (or save).
I have limited VBA experience and have tried to pull together different code for different purposes but honestly I'm lost.

I expect all selections (215 in total) in the drop down box to have been refreshed and printed (or saved in pdf) individually.

Any help greatly appreciated.


Private Sub CommandButton1_Click()
Sub Iterate_Through_data_Validation()
Dim dvCell As Range
Dim inputRange As Range
Dim c As Range


'Which cell has data validation
Set dvCell = Worksheets("Report_(2019_Season)").Range("K4")
'Determine where validation comes from
Set inputRange = Evaluate(dvCell.Validation.Formula1)

For Each c In inputRange
dvCell = c.Value
'add some print page code here

Dim GT As GreentreeExcelAddin
Set GT = Application.ExcelAddIns.Item("Greentree.ExcelAddIn").Object
GT.Refresh ("Report_(2019 Season)")

Next c

End Sub