Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Posts
    35

    Unhappy Unanswered: TransferSpreadsheet to a floppy

    HI,

    I have this problem and I hope somebody can help me.

    I want to transfer some information to an excel file in a floppy. I am using the transferspreadsheet method. There are different tables that I am transferring; therefore I am using a loop. Everything is fine, but now I want to trap the possible errors. How can I handle this possible problems??:

    - There is not floppy
    - The floppy is full
    - During the different transfers, the floppy get full

    Can you think in another possible problem??

    Thank you for your help.
    MARGA

  2. #2
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,476
    Provided Answers: 11
    Some Code
    old function I wrote year ago
    Code:
    Public Function FileExist(FileName) As Boolean
    On Error GoTo FileExistEH
    Dim FileNameReturned As String
    FileExist = False
    FileNameReturned = Dir(FileName)
    If Len(FileNameReturned) > 0 Then
        FileExist = True
    End If
    Exit Function
    FileExistEH:
    End Function
    will return a True / False if the FileExist("A:\filename.xls")

    to work the size will need to look at some vbscript

    found this in Microsoft Windows Script Technologies
    Microsoft Script
    Code:
    Function ShowSpaceInfo(drvpath)
       Dim fso, d, s
       Set fso = CreateObject("Scripting.FileSystemObject")
       Set d = fso.GetDrive(fso.GetDriveName(fso.GetAbsolutePathName(drvpath)))
       s = "Drive " & d.DriveLetter & ":"
       s = s & vbCrLf
       s = s & "Total Size: " & FormatNumber(d.TotalSize/1024, 0) & " Kbytes"
       s = s & vbCrLf
       s = s & "Available: " & FormatNumber(d.AvailableSpace/1024, 0) & " Kbytes"
       ShowSpaceInfo = s
    End FunctionEnd Function
    lets change it
    Code:
    Function ShowSpaceInfo(drvpath)
       Dim fso, d, s
       Set fso = CreateObject("Scripting.FileSystemObject")
       Set d = fso.GetDrive(fso.GetDriveName(fso.GetAbsolutePathName(drvpath)))
     '  s = "Drive " & d.DriveLetter & ":"
     '  s = s & vbCrLf
       s =  FormatNumber(d.TotalSize/1024, 0)
     '  s = s & vbCrLf
     '  s = s & "Available: " & FormatNumber(d.AvailableSpace/1024, 0) & " Kbytes"
     '  ShowSpaceInfo = s
    End Function
    not tested but should work

    that AvailableSpace look like a good idaea
    hope this help

    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.
    DONT WORRY ABOUT THOSE WHO TALK BEHIND YOUR BACK
    THEY'RE BEHIND YOU FOR A REASON

  3. #3
    Join Date
    Apr 2004
    Posts
    35

    Smile

    Thank you very much for your help, your code work perfect.
    MARGA

Posting Permissions

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