?
Solved

Refresh Excel data when opening the Excel file

Posted on 2011-10-25
6
Medium Priority
?
438 Views
Last Modified: 2012-08-14
In a MS Excel 2007 file I could create a link to a SQL server database. I open the Excel file --> Data->Refresh All. This refreshes the Excel contents that is tied to the SQL server database table. Is it possible to have the Excel file refresh the data every time the Excel file is opened?

0
Comment
Question by:toooki
  • 3
  • 2
6 Comments
 
LVL 3

Assisted Solution

by:varontron
varontron earned 948 total points
ID: 37028854
Hi,

Yes, it's easy.  Use the Connections dialog to define the behavior.

Here are detailed instructions from MS.

http://office.microsoft.com/en-us/excel-help/refresh-connected-imported-data-HP010087045.aspx#BMautomatically_refresh_data_when_a_wor

And a screenshot
Screen-shot-2011-10-25-at-21.34..png
0
 

Author Comment

by:toooki
ID: 37029055
Thanks a lot. I followed the steps. It did not work for some reason -- I think my fault. I am trying again. Thanks for the link.
0
 
LVL 3

Expert Comment

by:Davy2270
ID: 37030134
You can also use the auto open macro. This macro will run automatically when the workbook is opened.

Paste this code in your workbook's VBA module, and you're good to go.

Sub auto_open()
        ActiveWorkbook.RefreshAll
End Sub

Regards,
Davy
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

Author Comment

by:toooki
ID: 37103896
Thank you. Actually I cannot open the VBA module.
Mine is Excel 2007.
I do not see any "Tool" menu there.
0
 
LVL 3

Accepted Solution

by:
Davy2270 earned 952 total points
ID: 37107597
To open the VB editor:
choose  Visual Basic in the Developer tab in the ribbon.
or
press Alt + F11

Right click on VBAproject (your workbookname) and choose Insert then Module.

Paste this code in your module - that's the big white window on the right:
Sub auto_open()
        ActiveWorkbook.RefreshAll
End Sub

Save your file. Then, when re-opening your excel file the links will be automatically updated.

If that doesn't work out for you, please share your file.

Regards,
Davy
0
 

Author Comment

by:toooki
ID: 37205074
It worked. Thank you,
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, we’ll look at how to deploy ProxySQL.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question