ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   DisplayAlerts and QueryTable issues (https://www.excelbanter.com/excel-programming/381931-displayalerts-querytable-issues.html)

John Keith[_2_]

DisplayAlerts and QueryTable issues
 

Application.DisplayAlerts = False
Sheets("SiteData").Select
Selection.QueryTable.Refresh BackgroundQuery:=False

the Query was created manually by going through the menu drop downs and
selecting the file, then seperating the data into proper columns.

When executing this code from an Auto_Open the dialog boxes still popup.
The Default info is already properly set in the connection string. How do I
prevent these pesky dialog boxes from interrupting the flow?

From the "Refresh" method's help screens...
After Microsoft Excel makes a successful connection, it stores the completed
connection string so that prompts won't be displayed for subsequent calls to
the Refresh method during the same editing session. You can obtain the
completed connection string by examining the value of the Connection property.

It seems that since I am calling the .refresh upon initial loading of the
spreadsheet this qualifies as the first successful connection for this edit
session.

How do i force the refresh to use all the defaults?


--
Regards,
John

John Keith[_2_]

DisplayAlerts and QueryTable issues
 
I think I found the answer....
When creating the query, at the point where you specify where to insert the
data; there is an advanced button, and inside is a setting that defaults to
"prompt for filename on Refresh" I unchecked this box and now the refresh
method called from auto_open uses the defaults.

I also that I could set the refresh to automatic on workbook open. but in
my case I did not want that to happen because the Auto_Open, prior to needing
a querytable.refresh has a choice to download via FTP from a mainframe that
is not yet allowing XML calls to get it's data. So If I dont FTP, then there
is no need to refresh the query table.


--
Regards,
John


"John Keith" wrote:


Application.DisplayAlerts = False
Sheets("SiteData").Select
Selection.QueryTable.Refresh BackgroundQuery:=False

the Query was created manually by going through the menu drop downs and
selecting the file, then seperating the data into proper columns.

When executing this code from an Auto_Open the dialog boxes still popup.
The Default info is already properly set in the connection string. How do I
prevent these pesky dialog boxes from interrupting the flow?

From the "Refresh" method's help screens...
After Microsoft Excel makes a successful connection, it stores the completed
connection string so that prompts won't be displayed for subsequent calls to
the Refresh method during the same editing session. You can obtain the
completed connection string by examining the value of the Connection property.

It seems that since I am calling the .refresh upon initial loading of the
spreadsheet this qualifies as the first successful connection for this edit
session.

How do i force the refresh to use all the defaults?


--
Regards,
John



All times are GMT +1. The time now is 11:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com