Results 1 to 5 of 5
  1. #1
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,365

    File Size loop

    Hi Guy's happy new year to you all....



    Is there a method of retuning file name sizes in an input box between MsgBox and End Select ?

    What my plan would be is to check the file size in an input box then I would options from the input box to resize or exit sub

    Some thing like

    Inputbox("Enter File Option ?" & vbcrlf & vbcrlf & _
    DMT Image 1 = 804kb
    DMT Image 2 = 9kb
    DMT Image 3 = 706kp & vbcrlf & vbcrlf & _
    "Leave Blank To Exit Sub" & vbcrlf & vbcrlf & _
    Enter 1 To Open Specific File Name" & vbcrlf & vbcrlf & _
    Enter 2 To Open All Files" etc..... etc......

    I have had a quick search internet but can't see too much on returning file sizes in an array of files

    The part I am struggling to find is how to return file sizes into inputbox ????

    Code:
    Dim strPathFrom, strFileName As String, strPathTo As String, strName As String, strFiles As StringDim varOpt As Variant
    Dim i As Integer
    
    
    varOpt = Me.optCamera
    
    
    Select Case varOpt
    
    
        Case Is = False
        
        Me.optFolder = False
        
        Exit Sub
        
        Case Else
        
        
        strPathFrom = Forms!frmMainMenu!cboDrive & "\DCIM\101MSDCF\"
        strPathTo = "T:\DMT Ltd\Cam Images\"
        strFiles = Dir(strPathFrom & "*.jpg")
    
    
        While strFiles <> ""
        i = i + 1
        strName = "DMT Image" & " " & i & ".jpg"
            Name strPathFrom & strFiles As strPathTo & strName
            
        strFiles = Dir
        
        Wend
        
        Kill strPathFrom & "\*.*"
        
        
        MsgBox ("You Can Now Remove The SD Card From Your Computer"), vbInformation + vbOKOnly, "FILES MOVED"
    
    
        
    End Select

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,558
    You would need to get the size first before using InputBox?
    Google how to get a file size, then append to the message of the inputbox.
    Personally I would use a form.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,365
    Okie Dokie WGM thank you

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Happy New Year! Please have a look at the attached sample, I use it to load various files as OLE objects in a form for preview but should give you all the pieces you need. Specifically you want the modProcessFiles module and the code that populates the listbox on the form.

    Cheers,
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,365
    Thanks Vlad, thank you yes i will have a look

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 12
    Last Post: 10-21-2018, 05:49 PM
  2. Replies: 14
    Last Post: 05-24-2017, 02:22 PM
  3. Replies: 2
    Last Post: 04-01-2016, 10:38 AM
  4. File Import Loop
    By Rob D in forum Programming
    Replies: 1
    Last Post: 06-06-2013, 06:43 PM
  5. With VB, how can you get the DB file size?
    By KathyL in forum Programming
    Replies: 1
    Last Post: 11-16-2010, 01:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums