ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Suppress File Selection Box (https://www.excelbanter.com/excel-programming/408293-suppress-file-selection-box.html)

BCBarney

Suppress File Selection Box
 
I have some code that is importing a specific file based on some variables
input into some input boxes. The files will always have the same naming
scheme and the macro will import the correct file based on the code and
variables. My problem is that the code is opening a dialog box in order to
select the file. My code already selects the file so the user has to hit ok
in order to move on. I want to suppress this dialog box as the code should
be doing the opening of the file. I've attempted turning the DisplayAlerts
to false and it hasn't worked to suppress the box. I've searched the board
for all of the keywords I can think of without any success. Thank you in
advance for your assistance. I can post my code if needed.

Thank you,
Brian

Jim Thomlinson

Suppress File Selection Box
 
Post the code...
--
HTH...

Jim Thomlinson


"BCBarney" wrote:

I have some code that is importing a specific file based on some variables
input into some input boxes. The files will always have the same naming
scheme and the macro will import the correct file based on the code and
variables. My problem is that the code is opening a dialog box in order to
select the file. My code already selects the file so the user has to hit ok
in order to move on. I want to suppress this dialog box as the code should
be doing the opening of the file. I've attempted turning the DisplayAlerts
to false and it hasn't worked to suppress the box. I've searched the board
for all of the keywords I can think of without any success. Thank you in
advance for your assistance. I can post my code if needed.

Thank you,
Brian


BCBarney

Suppress File Selection Box
 
As stated before, if I ok the dialog box that appears every runs fine but I
want to not have to deal with the dialog box.

Sheets("Sheet1").Select
Range("A1").Select
With Selection.QueryTable
.Connection = _
"TEXT;\\maninfs1\account\FINANCE\" & Year & "\" & Month &
"\Files\ShowProfit" & Year & "" & Month & ""
.TextFilePlatform = 1252
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(30, 8, 13, 16, 19, 17)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With

"Jim Thomlinson" wrote:

Post the code...
--
HTH...

Jim Thomlinson


"BCBarney" wrote:

I have some code that is importing a specific file based on some variables
input into some input boxes. The files will always have the same naming
scheme and the macro will import the correct file based on the code and
variables. My problem is that the code is opening a dialog box in order to
select the file. My code already selects the file so the user has to hit ok
in order to move on. I want to suppress this dialog box as the code should
be doing the opening of the file. I've attempted turning the DisplayAlerts
to false and it hasn't worked to suppress the box. I've searched the board
for all of the keywords I can think of without any success. Thank you in
advance for your assistance. I can post my code if needed.

Thank you,
Brian



All times are GMT +1. The time now is 04:28 AM.

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