Results 1 to 8 of 8

Thread: add new file

  1. #1
    New Member
    Join Date
    Aug 12
    Posts
    7

    add new file

    hi!

    I am trying to when my user scan image it check how many image in folder and then add +1 image to that folder and save. Please help me where am i wrong in below code cos it scan and save but not add in folder

    Code:
    Private Sub vstwain1_PostScan(ByVal flag As Long)
    If flag <> 0 Then
              If vstwain1.errorCode <> 0 Then
                  MsgBox vstwain1.errorString
               End If
              Else
                 
        Dim lnFileCount As Long
        Dim sphotocount As Long
        Dim sPhotoFile As String
        Dim sNewFile As String
        
        
           sPhotoFile = Dir(sPhotoPath & "\photo *.jpg")
           lnFileCount = lnFileCount + 1
           sNewFile = sPhotoPath & "photo" & (lnFileCount) & ".jpg"
      Set Image1.Picture = vstwain1.GetCurrentImage
           If vstwain1.SaveImage(0, sNewFile) = 0 Then
                 MsgBox vstwain1.errorString
              End If
          End If
        
    End Sub

    thanks
    Last edited by koolsid; Aug 29th, 2012 at 03:47 AM. Reason: Added Code Tags

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 04
    Location
    New Amsterdam
    Posts
    23,655

    Re: add new file

    First you need to determine number of files in a specified directory - there are few methods ubt perhaps simplest one would be to use FileSystemObject.

    In your case using function from that link may look like this:
    Code:
    lnFileCount = GetFileCount(sPhotoPath) + 1
    'rest of your code goes here...

  3. #3
    New Member
    Join Date
    Aug 12
    Posts
    7

    Re: add new file

    i got error
    sub or function not define (highlited "getfile')

    thanks for reply

  4. #4
    Hyperactive Member
    Join Date
    May 12
    Posts
    338

    Re: add new file

    u want it like this ??

    it saves images in c:\
    Last edited by koolsid; Aug 29th, 2012 at 03:45 AM. Reason: Removed attachment which contained only the exe.

  5. #5
    New Member
    Join Date
    Aug 12
    Posts
    7

    Re: add new file

    thanks for reply
    yes , same way i need to do how can i do that

  6. #6
    Hyperactive Member
    Join Date
    May 12
    Posts
    338

    Re: add new file

    Attachment 90673
    Attached Files Attached Files
    Last edited by koolsid; Aug 29th, 2012 at 03:41 AM. Reason: Removed EXE from attachment

  7. #7
    New Member
    Join Date
    Aug 12
    Posts
    7

    Re: add new file

    add.rar is exe file can u help me for the code
    thanks

  8. #8
    Hyperactive Member
    Join Date
    May 12
    Posts
    338

    Re: add new file

    the second add.rar file is with code + exe file download the add.rar file in second post

Posting Permissions

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