PDA

View Full Version : Refreshing connection



DavidWaldo
02-20-2017, 03:37 AM
Ok, I have a workbook that uses SQL to download data, sorts it with VBA, creates another workbooks etc. This workbook is running on my server 24/7. I have another workbook with settings(with stuff like, on monday create only two workbooks, on friday create three workbooks). Do I have to add an code for refreshing to main workbook, or does it refresh itself everytime i change the settings workbook?

DavidWaldo
02-21-2017, 12:07 AM
OK....
So I'll explain it another way. I have two workbooks. Main workbook and Settings workbook.
Main workbook is running 24/7 and runs **** load of macros. The Setting workbook has only one sheet with just one table, setting for the main workbook. Both workbooks are connected. The main workbook takes data from settings workbook. What I want to know, do I have to refresh the main workbook every time I change something in settings workbook or does it refresh it self before it executes the macros?
Or is this code enough?


ActiveWorkbook.RefreshAll
ActiveWorkbook.RefreshAll

mancubus
02-21-2017, 07:18 AM
if you mean Main Workbook has formulas linked to Setting Workbook and you need to recalculate the formulas, yes.

DavidWaldo
02-21-2017, 08:18 AM
Yes! Thats what i ment. Is my code enough to recalculate formulas?

mancubus
02-21-2017, 11:05 AM
check these out:

https://msdn.microsoft.com/en-us/library/office/ff838648.aspx

https://msdn.microsoft.com/en-us/library/office/ff195517.aspx