Results 1 to 7 of 7

Thread: convert the data from .xlsx to .txt file: Export Excel cell values to delimeted text File

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0

    Macro Correction converting data from .xlsx to notepad

    Hi,

    I have a macro that converts the data from .xlsx to notepad But there is some issue with the notepad data, sometimes my system reads it & sometimes not bcoz the data may have issues like in notepad the data may be as value or the data will
    have different format data Or it can be xyz issue

    I am sending the notepad file which i downloaded from system & system accept that type of notepad files & reads all the data of notepad files , so plz see the system notepad file & correct the macro according to that , the data which this macro creates should be exact same to same format or types ,i dont know what is the exact issue

    Code:
    Sub STEP24()
    Dim wb1 As Workbook
    Set wb1 = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\HotStocks\Alert.xlsx")
    Dim ws1 As Worksheet: Set ws1 = wb1.Worksheets.Item(1)
    Dim lr As Long, Lc As Long
     Let lr = ws1.Cells.Range("A" & ws1.Rows.Count & "").End(xlUp).Row
     Let Lc = ws1.Cells.Item(1, ws1.Columns.Count).End(xlToLeft).Column
    Dim arrIn() As Variant: Let arrIn() = ws1.Range(ws1.Range("A1"), ws1.Cells.Item(lr, Lc)).Value
    Dim Rw As Long, Clm As Long '
        For Rw = 1 To lr
            For Clm = 1 To Lc
            Dim strTotalFile As String
             Let strTotalFile = strTotalFile & arrIn(Rw, Clm) & ","
            Next Clm
         Let strTotalFile = Left(strTotalFile, Len(strTotalFile) - 1)
         Let strTotalFile = strTotalFile & vbLf
        Next Rw
     Let strTotalFile = Left(strTotalFile, Len(strTotalFile) - 1)
     Debug.Print strTotalFile
    
    Dim FileNum As Long
    Let FileNum = FreeFile(1)
     Open "C:\Users\WolfieeeStyle\Desktop\Alert..txt" For Output As #FileNum
     Print #FileNum, strTotalFile
     Close #FileNum
     wb1.Close
     
    End Sub



    Alert.txt is the system data



    https://www.excelforum.com/excel-pro...o-notepad.html
    Attached Files Attached Files

Similar Threads

  1. Convert Text from .txt to columns in excel
    By ravichandavar in forum Excel Help
    Replies: 2
    Last Post: 07-21-2017, 07:35 AM
  2. Button to export data to a master file
    By aryanaveen in forum Excel Help
    Replies: 0
    Last Post: 01-17-2015, 02:35 AM
  3. Replies: 7
    Last Post: 05-20-2014, 02:10 AM
  4. populate default values in cell of a csv file
    By dhivya.enjoy in forum Excel Help
    Replies: 2
    Last Post: 10-23-2013, 12:59 PM
  5. Import text file to an Excel file
    By obed_cruz in forum Excel Help
    Replies: 5
    Last Post: 08-03-2011, 07:58 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •