Enable Data Connections in Excel 2011 for mac

Posted on 2011-03-03
Last Modified: 2012-05-11
I have a couple of macros that I originally set up in Excel 2007 for PC that pull data from a web query and use Application.OnTime in a Workbook_Open event to refresh and save at a certain time automatically every night (it uses task scheduler to automatically open Excel daily).  I'm trying to accomplish this in 2011 for mac and am being thwarted by the need to re-enable data connections every time the workbook opens.  

I've tried recording a macro while the "enable content" security warning that pops up when you open the workbook is still active, but nothing records.  I can't find any settings to permanently enable web queries.

Is there a way to permanently enable the content?  A way to write the re-enabling into a macro?

Any help would be much appreciated!
Question by:kwazi5
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 30

Expert Comment

ID: 35033969
>>A way to write the re-enabling into a macro?

I am not 100% sure but check the Workbook.EnableConnections Method for enabling the connection.


Author Comment

ID: 35034118
I'm not entirely sure I've done this right, but I got the error below.

my code:
In ThisWorkbook:

Private Sub Workbook_Open()

Run "EnableWorkbookConnections"

End Sub

In a module, I have:

Sub EnableWorkbookConnections()


End Sub

And I get:

Compile Error:

Method or data member not found

Expert Comment

ID: 35034403
Try it like this

This is assuming that VBA works the same on a Mac

Private Sub Workbook_Open()


End Sub

Sub EnableWorkbookConnections()


End Sub
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 35106209
Sorry for the delayed response.  Just got a chance to work on this again tonight.

TinTombStone - I tried your suggestion and received the same compile error when it reached .EnableConnections.  I'm guessing this means the function is not available in this version of excel?

Again, apologies for the delay.

Author Comment

ID: 35318247
It would be nice if someone could confirm that Excel 2011 for mac does not allow you to enable data connections via code.  I've found no way to enable connections other than to click on the button that pops up upon opening a book with an established data connection.
LVL 30

Accepted Solution

SiddharthRout earned 500 total points
ID: 35320393
If my understanding is correct, then at the moment it seems like you cannot do that.

Please see this link

Title: Import data from a database


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

717 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