Click here to Skip to main content
16,012,468 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi , here in the below coding i got the file readed and writed to a new file , but i done this for a single file , how can i do it for multiple files




VB
Sub read1()
       Dim missing As Object = System.Reflection.Missing.Value
       Dim oFals As Object = False
       Dim oTru As Object = True

       Try
           objapp = New word.Application
           objdoc = New word.Document

           Dim obj As Object = ListBox1.SelectedItem
           If ListBox1.SelectedIndex < 0 Then
           Else
               If ListBox1.Items.Count > 0 Then
                   objdoc = objapp.Documents.Open(obj, missing, oTru, oTru)
                   objapp = New word.Application
                   objdoc = New word.Document
                   objdoc = objapp.Documents.Add(obj)
                   objdoc.SaveAs("d:\wrrd.doc")
                   objdoc.Activate()
                   objdoc.Close()
                   objapp.Quit()
                   objdoc = Nothing
                   objapp = Nothing
               End If
           End If

       Catch ex As Exception
           MsgBox("read error")
       End Try

   End Sub
Posted

1 solution

create a function with parameter of 'filename'... and call the same inside a loop, generate the file names as you desire...... :)
 
Share this answer
 
Comments
LanFanNinja 14-Nov-11 8:31am    
+5 sounds good to me :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900