Answer Posted / yogesh
'MERGE CONTENTS OF TWO FILE
Option Explicit
Const conForReading = 1
Const ForAppending = 8
Dim objFSO: Set objFSO = CreateObject
("Scripting.FileSystemObject")
Dim file1,file2,file3,contents1,contents2
Dim strfile1,strfile2,strfile3 'Declare
variables
strfile1=inputbox("Enter path of Source file 1","Copy file
utility"," ")
strfile2=inputbox("Enter path of Source file 2","Copy file
utility"," ")
strfile3=inputbox("Enter path of To Create Target
file","Copy file utility"," ")
Set file1 = objFSO.OpenTextFile(strfile1, conForReading,
False)
Set file2 = objFSO.OpenTextFile(strfile2, conForReading,
False)
Set file3 = objFSO.CreateTextFile(strfile3, ForAppending,
True)
'Set Objects
contents1 = file1.ReadAll
contents2 = file2.ReadAll
'Read file contents
file1.Close
file2.Close
'Close file after use
file3.WriteLine(contents1)
file3.writeLine(contents2)
'Write contents to file
file3.Close
'Close file after use
Set file1 = Nothing
Set file2 = Nothing
Set file3 = Nothing
Set objFSO = Nothing
'freezing memory of objects
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is scope rule in c?
What is pre-emptive data structure and explain it with example?
How are structure passing and returning implemented?
What is the purpose of 'register' keyword?
find out largest elemant of diagonalmatrix
How are 16- and 32-bit numbers stored?
How can I list all of the predefined identifiers?
What is modifier & how many types of modifiers available in c?
What is floating point constants?
What is the use of typedef in c?
What is the size of enum in c?
What are the general description for loop statement and available loop types in c?
What is null pointer constant?
A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none
What is the difference between scanf and fscanf?