Results 1 to 1 of 1

Using the OPEN statement to append the data from one wkb to another

Threaded View

  1. #1
    Valued Forum Contributor SDruley's Avatar
    Join Date
    04-27-2009
    Location
    Conover, NC
    MS-Off Ver
    Excel 2010 64 bit
    Posts
    415

    Red face Using the OPEN statement to append the data from one wkb to another

    Type Record
        ID As Integer
        Name As String * 20
    End Type
    Sub AddendFile()
    ' TEST1 = Master File
    ' TEST2 = Add-on File
    Dim MyRecord As Record
    Dim RecordNumber
    Dim MaxSize
    ChDir "C:\Users\Steve\ftp\Beta"
    Open "TEST1.xlsm" For Random As #1 Len = Len(MyRecord)
    Open "TEST2.xlsm" For Random As #2
    MaxSize = Len(MyRecord)     ' Get number of records in master.
    For RecordNumber = 1 To 3 'Number of new records to place in master
                Position = MaxSize + RecordNumber - 1
                Seek #1, Position ' Put pointer at end of master
                Seek #2, RecordNumber    ' Put pointer at beginning of add-on
                Get #2, , MyRecord    ' Read record in add on
    '********************************************************************************************************
                Put #1, Position, MyRecord   ' Place record at end of master    'ERROR 75 FILE/PATH ACCESS ERROR
    '********************************************************************************************************
    Next RecordNumber
    Close #1
    Close #2
    End Sub
    The above code generates error 75. Need to know how to work around.

    I have two workbooks
    TEST1.xlsm = Master file that has in column A the numbers 1 through 21
    TEST2.xlsm = A file that contains new data (A,B.C) to be appended to TEST1.xlsm
    I want Test1 to read vertically in column A 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,A,B,C

    The error stops me from meeting my goal.
    Last edited by SDruley; 08-12-2010 at 11:29 AM. Reason: Reformatted the code

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1