Convert data file or text file in to Excel File
................. Creat a Data file with Visual Basic 6 and then convert the created file in to Excel work book .............................
By Mr. Adeeb Raza of Areptone Electronic Products.
************************************************************************************************

  • Download areptone_cadel.zip file & see all the following example in the VB6 programe
  • (areptone_cadel.zip file)
  •  
  • Open Data file for Output Data (This is for only one Line)
  • Open "C:\AEP\AEP.DAT" For Output As #1
    Write #1, Sr, Srp, Dt, Tm, VR, VY, VB, AR, AY, AB, PF, HZ, KWH, KVA
    Close #1
  •  
  • Open Data file for Input Data (This is for only one Line)
  • Open "C:\AEP\AEP.DAT" For Input As #1
    Input #1, Sr, Srp, Dt, Tm, VR, VY, VB, AR, AY, AB, PF, HZ, KWH, KVA
    Close #1
  •  
  • Open Data file for Append Data (This is for Multiline)
  • Open "C:\AEP\AEP.DAT" For Append As #1
    Write #1, Sr, Dt, Tm, VR, VY, VB, AR, AY, AB, PF, HZ, KWH, KVA
  • Close #1
  •  
  • ..(a) Creat a Data file with Visual Basic 6 ..... (click here & download VB 6 Code)
    ..(b) Convert the created Data file in to Excel work book manualy.
  • ..
  • Proseed step by step as given following
    ..1.. Dat file Open with Microsoft Office Excel
    ..2.. Select Colums A from No. 1 to 50 or all
    ..3.. Open Microsoft Office Excel Data Menu and Click on Tex to Columns…..
    ..4.. Check “Convert Text to Column Wizard Step – 1 of 3" Select on Delimted
    ..5.. “Convert Text to Column Wizard” Click on Next
    ..6.. “Convert Text to Column Wizard” see Delimters --> Select Tab & Comma
    ..7.. “Convert Text to Column Wizard” Click Next
    ..8.. “Convert Text to Column Wizard” Click Finish
    ..9.. See Dat file is now converted in to Microsoft Excel WorkBook
    ..10. Now Save Excel Work Book with a file name

*******************************************************************************************

Use DOS & SHELL Command in Visual Basic 6
*****************************************************************************

  • See Following Command use in VB 6
    Delete a file VB-6 Use....................................................... Kill command
    Delete File Peater.EXE in tne D Directory Peater ................................... Kill "D:\Peater\Peater.Exe"
    Make Directory VB-6 Use ................................................ MkDir("C:\NAME")
    Remove Directory VB-6 Use ............................................ RmDir("C:\NAME")
    .....

  • Use SHELL Command as following
    *******************************************

  • Example of Copy a file
    Option Explicit
    Dim AEP
    Private Sub Command1_Click()
    AEP = Shell("cmd
    /c copy /y c:\ar.zip d:\ar.zip", vbHide)
    End Sub

  •  
  • /c tells the cmd window to execute the string following. and /y on the dos command copy surpresses messages

.

.

.

.

.

.

.

.

.