Application.ImportTextFixed
This function imports a text file using fixed formatting.
Syntax | Parameters | Return Value |
---|---|---|
Function Application.ImportTextFixed( _ fileName As String, _ NbVars As Long, _ NbCases As Long, _ Optional startImport As Long = 1, _ Optional formatStatement As String = "", _ Optional bCaseNamesFromFirstColumn As Boolean = False) As Spreadsheet |
The fully-qualified pathway to the text file to import. Type: String How many variables to import. Type: Long How many cases to import. Type: Long The first case to begin import. This parameter defaults to 1. Type: Long Default value: 1 The format to apply when importing. Type: String Default value: "" Whether or not to import the first column in the text file as the case names. This parameter defaults to False. Type: Boolean Default value: False |
Spreadsheet |
SVB Example
Importing fixed text:
Option Base 1 Option Explicit Sub Main Dim S1 As Spreadsheet 'assigns the spreadsheet heart.sta to the spreadsheet object s1 Set S1 = Open(Path & "\Examples\Datasets\Heart.sta") 'saves the spreadsheet as a text file 'file saved as heart.txt s1.ExportText(Path & "\Heart.txt",1,0,1,0,9,True,False,False,True) Dim s2 As Spreadsheet 'imports heart.txt Set s2 = Application.ImportTextFixed(Path & _ "\Heart.txt",3,3,1,,False) 'sets the spreadsheet to visible s2.Visible = True End Sub
Copyright © 2020. Cloud Software Group, Inc. All Rights Reserved.