Resources
  • Home
  • December-Chrono
  • Psalm136Personalized
  • ExcelResources
    • 99PublicFunctions
    • aDelimitedCodeTemplate
    • aCodeTemplate
    • aBetter_Code_Template
    • ApplyFormulaValue
    • ArrayPublic
    • ArrayMatchCopyRow
    • Capitalization
    • Colors
    • DataTypes
    • DeleteRows
    • Filter
    • FormatStandard
    • Forms
    • Grid
    • Headers
    • ImageScrape
    • InputBox
  • ExcelResources2
    • Like
    • List Review
    • MatchAndReturn
    • mod_Import
    • Numbers
    • PDF_Parse
    • RandomGenerator
    • iRe1
    • Rept
    • RelatedItemsLIst
    • RomanNumerals
    • SheetSplitter
    • Sort
    • Split Method
    • String_DataType
    • TabDelimited
    • Tab_InsertNew_or_ClearExisting
    • Unique_List
      • UniqueLIsts_FilterMethod
  • Excelresources_Files
    • FileLists
    • FileTextParse
    • Folders
  • excelresources_WebScrape
    • CreateList_1-Href_2-Jpg
    • TableData_Load_PlugPlay
    • CreateList_MultiPage_Image_Link
      • ImageDownload_WebLink_List
    • TableData_Load_ClassDiv
    • TableData_Load_ClassSpan
  • Houseboat Vacation
  • At the Foot of the King
  • Devotions
  • Mentoring
  • Inspirational Stories
    • Vacuum Lifting
  • Job Help
  • Resources
    • MS
    • Florida History
  • Contact
  • Heroscape
    • Fish
    • Playstation
  • You Tube Videos
  • House
    • Tiny Houses
    • Backyards
  • CampingResources
    • CampingLand
    • LED Throwies
  • Interesting
  • Recipes
  • Xbox
  • Skydiving
  • ReadingPlan-5Year
  • Desoto
  • BibleStudy
  • HurricaneIrma
  • Home
  • December-Chrono
  • Psalm136Personalized
  • ExcelResources
    • 99PublicFunctions
    • aDelimitedCodeTemplate
    • aCodeTemplate
    • aBetter_Code_Template
    • ApplyFormulaValue
    • ArrayPublic
    • ArrayMatchCopyRow
    • Capitalization
    • Colors
    • DataTypes
    • DeleteRows
    • Filter
    • FormatStandard
    • Forms
    • Grid
    • Headers
    • ImageScrape
    • InputBox
  • ExcelResources2
    • Like
    • List Review
    • MatchAndReturn
    • mod_Import
    • Numbers
    • PDF_Parse
    • RandomGenerator
    • iRe1
    • Rept
    • RelatedItemsLIst
    • RomanNumerals
    • SheetSplitter
    • Sort
    • Split Method
    • String_DataType
    • TabDelimited
    • Tab_InsertNew_or_ClearExisting
    • Unique_List
      • UniqueLIsts_FilterMethod
  • Excelresources_Files
    • FileLists
    • FileTextParse
    • Folders
  • excelresources_WebScrape
    • CreateList_1-Href_2-Jpg
    • TableData_Load_PlugPlay
    • CreateList_MultiPage_Image_Link
      • ImageDownload_WebLink_List
    • TableData_Load_ClassDiv
    • TableData_Load_ClassSpan
  • Houseboat Vacation
  • At the Foot of the King
  • Devotions
  • Mentoring
  • Inspirational Stories
    • Vacuum Lifting
  • Job Help
  • Resources
    • MS
    • Florida History
  • Contact
  • Heroscape
    • Fish
    • Playstation
  • You Tube Videos
  • House
    • Tiny Houses
    • Backyards
  • CampingResources
    • CampingLand
    • LED Throwies
  • Interesting
  • Recipes
  • Xbox
  • Skydiving
  • ReadingPlan-5Year
  • Desoto
  • BibleStudy
  • HurricaneIrma
Connect on Facebook

Parse out Large Text Files

IN progress...

Note: Add Standard Loop objects (x/y)
    'Creating a FileSystemObject
    Public FSO As New FileSystemObject
    
    Sub CreateFile()
    Dim TxtStr As TextStream
    Dim FileName As String
    Dim FileContent  As String
    Dim File As File
    Dim sMyString As String
    Dim aSplitMeA As Variant, aSplitMeB As Variant
    
    'FileName = "C:\TestDirectory\File.txt" 'File to be created
    FileName = Application.GetOpenFilename("Text Files (*.txt),*.txt", , "Select Text Data File")
    
    'Creating a file and writing content to it
    'FileContent = InputBox("Enter the File Content")
    'If Len(FileContent) > 0 Then
    '  Set TxtStr = FSO.CreateTextFile(FileName, True, True)
    '  TxtStr.Write FileContent
    '  TxtStr.Close
    'End If
    
    ' Reading from the file that we have just created
    If FSO.FileExists(FileName) Then
      Set File = FSO.GetFile(FileName)
      Set TxtStr = File.OpenAsTextStream(ForReading, TristateUseDefault)
      sMyString = TxtStr.readall
      'MsgBox Left(sMyString, 25) & Chr(13) & Right(sMyString, , 25)
    TxtStr.Close
    End If
    
    
'Start processing the file string
      'Show the starting length of the string
      Debug.Print "Full String: " & Len(sMyString)
      
      'Show the # of [(] in the string
      Debug.Print "Char [(] Count: " & Len(sMyString) - Len(Replace(sMyString, "(", "", , , vbTextCompare))
      
      'Show the # of [LineFeeds] in the string
      Debug.Print "Char [Line Feeds] Count: " & Len(sMyString) - Len(Replace(sMyString, Chr(10), "", , , vbTextCompare))
            
                'Remove the line Feeds:
                sMyString = Replace(sMyString, Chr(10), "", , , vbTextCompare)
                
                'Show the new count
                Debug.Print "REVISED --- Full String: " & Len(sMyString)
'=================stop here - untested - need to create delimiters
                
                
                
                'Change the 1st Attributes value to match the rest
                sMyString = Replace(sMyString, "array (  '", ",  '", , , vbTextCompare)
                
                'Add a Split for all the Attributes
                sMyString = Replace(sMyString, ",  '", ", |'", , , vbTextCompare)
                
                
                
                
                'Change all [Space x 4] to [^]
                sMyString = Replace(sMyString, "array (    0", "array(^0", , , vbTextCompare)
                
                
                'Change all [Space x 3] to [|]
                'sMyString = Replace(sMyString, "   ", "|", , , vbTextCompare)
                
 aSplitMeA = Split(sMyString, "|")
For x = LBound(aSplitMeA) To UBound(aSplitMeA)
DoEvents
    aSplitMeB = Split(aSplitMeA(x), ",", , vbTextCompare)
    GoTo gMemoryCleanup
    For y = LBound(aSplitMeB) To UBound(aSplitMeB)
        Debug.Print Left(aSplitMeB(y), 30)
    Next y
Next x
      
                ' Finally Deleting the File
                'File.Delete (True)

gMemoryCleanup:
    Erase aSplitMeA: Erase aSplitMeB
    End Sub




Function TestSubArray(sMyText As String, iStartPos As Long)
Dim iNext As Long, iOpen As Long, iClose As Long
iNext = 0

TestSubArray = 0
iOpen = InStr(iStartPos + 1, sMyText, "(", vbTextCompare)
iClose = InStr(iStartPos + 1, sMyText, ")", vbTextCompare)

'Test to make sure the character [(] was found, if it was, return the next occurence
If iOpen > 0 Then TestSubArray = iOpen

'Test to make sure the character [)] was found, if it was, return the next occurence (over-rides the current value is set during iOpen
If iClose > 0 And iClose < iOpen Then TestSubArray = iClose
End Function

Powered by Create your own unique website with customizable templates.
  • Home
  • December-Chrono
  • Psalm136Personalized
  • ExcelResources
    • 99PublicFunctions
    • aDelimitedCodeTemplate
    • aCodeTemplate
    • aBetter_Code_Template
    • ApplyFormulaValue
    • ArrayPublic
    • ArrayMatchCopyRow
    • Capitalization
    • Colors
    • DataTypes
    • DeleteRows
    • Filter
    • FormatStandard
    • Forms
    • Grid
    • Headers
    • ImageScrape
    • InputBox
  • ExcelResources2
    • Like
    • List Review
    • MatchAndReturn
    • mod_Import
    • Numbers
    • PDF_Parse
    • RandomGenerator
    • iRe1
    • Rept
    • RelatedItemsLIst
    • RomanNumerals
    • SheetSplitter
    • Sort
    • Split Method
    • String_DataType
    • TabDelimited
    • Tab_InsertNew_or_ClearExisting
    • Unique_List
      • UniqueLIsts_FilterMethod
  • Excelresources_Files
    • FileLists
    • FileTextParse
    • Folders
  • excelresources_WebScrape
    • CreateList_1-Href_2-Jpg
    • TableData_Load_PlugPlay
    • CreateList_MultiPage_Image_Link
      • ImageDownload_WebLink_List
    • TableData_Load_ClassDiv
    • TableData_Load_ClassSpan
  • Houseboat Vacation
  • At the Foot of the King
  • Devotions
  • Mentoring
  • Inspirational Stories
    • Vacuum Lifting
  • Job Help
  • Resources
    • MS
    • Florida History
  • Contact
  • Heroscape
    • Fish
    • Playstation
  • You Tube Videos
  • House
    • Tiny Houses
    • Backyards
  • CampingResources
    • CampingLand
    • LED Throwies
  • Interesting
  • Recipes
  • Xbox
  • Skydiving
  • ReadingPlan-5Year
  • Desoto
  • BibleStudy
  • HurricaneIrma