whgordon44
New Member
- Joined
- Mar 17, 2020
- Messages
- 5
- Office Version
- 2021
- 2019
- Platform
- Windows
Using Excel 2021 In Windows 11 the following subroutine does not work when any of the three Addin lines are uncommented. (It worked using Excel 2019 in Windows 10).
VBA Code:
Private Sub workbook_open()
'AddIns("Analysis ToolPak").Installed = True
'AddIns("Analysis TbutoolPak - VBA").Installed = True
'AddIns("Solver Add-in").Installed = True
GetData
End Sub
Sub GetData()
Mypath = ActiveWorkbook.Path
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & Mypath & "\daps4out.txt" _
, Destination:=Range("A1"))
.Name = "daps4out_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 8
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
Last edited by a moderator: