ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Annoying Dialog Box (https://www.excelbanter.com/excel-programming/316215-annoying-dialog-box.html)

jason

Annoying Dialog Box
 
In cell "A1" I've created a Query using the wizard that simply imports
the contents of a Text file.
I've now recorded a macro to update this query:

Range("A1").QueryTable.Refresh BackgroundQuery:=True

and I've also tried:

Application.DisplayAlerts = False
Range("A1").QueryTable.Refresh BackgroundQuery:=True
Application.DisplayAlerts = True

When I run either of these and annoying dialog box appears named
"Import Text File" and I have to press "Import" for the macro to
continue

Anyone any ideas how to get rid of this, or am I up againsta
brickwall?
(there is a workaround but I'd rather plow straight ahead)

Any help greatly appreciated
Jason

Sean[_11_]

Annoying Dialog Box
 
Before you refresh your data (or even when you originally create the
query) set the following Data Range Property (it's very long name
describes exactly what it is)

Range("A1").QueryTable.TextFilePromptOnRefresh = True

----
Sean
"Just press the off switch, and go to sleep!"

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Dmoney

Annoying Dialog Box
 
I cannot duplicate, but sounds like the macro security
level may be invoking the popup.

Try lowering the Macro Security Level
tools...macro..security.



-----Original Message-----
In cell "A1" I've created a Query using the wizard that

simply imports
the contents of a Text file.
I've now recorded a macro to update this query:

Range("A1").QueryTable.Refresh BackgroundQuery:=True

and I've also tried:

Application.DisplayAlerts = False
Range("A1").QueryTable.Refresh BackgroundQuery:=True
Application.DisplayAlerts = True

When I run either of these and annoying dialog box

appears named
"Import Text File" and I have to press "Import" for the

macro to
continue

Anyone any ideas how to get rid of this, or am I up

againsta
brickwall?
(there is a workaround but I'd rather plow straight ahead)

Any help greatly appreciated
Jason
.



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

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