Refresh Data in Excel Sheet..

Microsoft Excel 2007
January 15, 2010 at 08:42:21
Specs: Windows 7

I have an excel file at some server and that same server is also having a database from which Excel file is fetching the data.

Now, i have a portal which is having a link to this Excel file and i want whenever any user clicks on that link, he should get refreshed data from the database. I do not want to give permission to anyone who might be using that link to Excel file but he should be able to refresh data. (I have a macro which refresh the data whenever the Excel file is opened where it is hosted, now i want that that macro should be run even when any other user is opening that Excel file - is it possible?)

Can anybody tell me the method to do this?

See More: Refresh Data in Excel Sheet..

January 19, 2010 at 10:36:56
re: "now i want that that macro should be run even when any other user is opening that Excel file"

If that is the main point of your question, then take a look at the Workbook_Open event.

In the VBA editor, double click the This Workbook module name. Use the Pull down next to General and select Workbook. That should put these lines in the pane:

Private Sub Workbook_Open()

End Sub

Place your code between these lines, making sure that the code refers to the correct sheets in the workbook and save it. The code should run everytime the workbook is opened.

You may need to add some error handling in case the source data isn't available or something else goes wrong. Since "general users" will be opening the workbook, you may not want them to see - or have to deal with - any errors that occur when the code runs.

Report •
Related Solutions

Ask Question