Appending files using VBA

  • Thread starter blanic via AccessMonster.com
  • Start date
B

blanic via AccessMonster.com

Ok so im trying to append a file to an existing file using VBA, im stuck at
the array I Believe, any help please?

Dim RetVal
Dim mFile As String, mPath As String
Dim Check As String
Dim MySize
Dim mFile2 As String
Dim nFilenum As Integer
Dim nFilenum2 As Integer
Dim B() As Byte



mPath = "E:\CGinst\Rpts\"
mFile = Dir(mPath & "2105.9")
mFile2 = Dir(mPath & "PostCard.9")

If mFile <> "" Then 'If file
exists
nFilenum2 = FreeFile
Open mFile For Binary Access Read As #1
B() = InputB(LOF(nFilenum2), nFilenum2)
Close #1


nFilenum = FreeFile
Open mFile2 For Append As #1
Write #1, B() 'Here is the problem, trying to get it to write from the
byte array to the file.
'mFile2.Close

Else
MsgBox "No 2105 Files to Print", , "Done"
Check = False
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top