Consulting

Results 1 to 5 of 5

Thread: Send data to a floppy disk.

  1. #1
    VBAX Regular
    Joined
    Dec 2004
    Posts
    26
    Location

    Send data to a floppy disk.

    I have an Excel system that calls up various information from vlookups etc, prints out order sheets, saves the workbook in case any changes have been made and copies some of the data (date, quantity,description) to another sheet as a log. It all works very well but I would like to add another function to it.

    Is it possible to make it copy a file stored elsewhere on the computer to a floppy disk?
    sort of - if this file exists, alert the user to insert a floppy disk, press OK to continue, then copy the file to the floppy and continue with the printout and save operations as normal.

    Thanks.

  2. #2
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Hello again outrider,


    Maybe you could use something like this ...


    Option Explicit
    
    Sub savetodisk()
        Application.DisplayAlerts = False
        Dim floppy As String, myFilePath As String, currPath As String, currFile As String
        floppy = "A:"
        myFilePath = "C:\Documents and Settings\Zack\My Documents"
        currPath = "C:\Documents and Settings\Zack\Desktop"
        currFile = ThisWorkbook.Name
        ThisWorkbook.Save
        If MsgBox("Please insert a disk into drive " & floppy & "." & vbCrLf & _
            "Press OK to continue, Cancel to quit.", vbOKCancel + vbInformation, _
            "Insert Floppy") = vbCancel Then Exit Sub
        On Error Resume Next 'if cancel is pressed for overwrite during next line of code.
        ThisWorkbook.SaveAs myFilePath & currFile
        ThisWorkbook.SaveAs currPath & currFile
        Application.DisplayAlerts = True
    End Sub

    Not sure of your exact specifics. Does this help/come close?

  3. #3
    VBAX Regular
    Joined
    Dec 2004
    Posts
    26
    Location
    My system reads a hidden worksheet and if a particular cell has a "Yes" in it, then it would copy the required file out of one of 25 folders (machine setting data for temperatures, injection pressures, clamping force etc) and put it onto a floppy disk so that it is produced with the order sheet at the same time.

    Thanks for your help.

  4. #4
    BoardCoder
    Licensed Coder
    VBAX Expert mark007's Avatar
    Joined
    May 2004
    Location
    Leeds, UK
    Posts
    622
    Location
    use:

    [vba]
    FileCopy "path to file\filename", "a:\filename"
    [/vba]

    "Computers are useless. They can only give you answers." - Pablo Picasso
    Mark Rowlinson FIA | The Code Net

  5. #5
    VBAX Regular
    Joined
    Dec 2004
    Posts
    26
    Location
    Mark007

    Thanks, simple and it worked.

Posting Permissions

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