Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2002

    Unanswered: Saving files from the web

    Does anyone know how to save a file directly from the web.

    the following opens up a file but I want the file to be copied directly to my c:\

    strAddress = "https://www....../..../...../pricelist.csv"
    Application.FollowHyperlink strAddress, , True

    Thanks in advance.

  2. #2
    Join Date
    Feb 2004
    Chicago, IL
    It's not very elegant, but... You can use SendKeys to do the copy.

        Application.FollowHyperlink "Your URL", , True, False
        'Pause 12 seconds for page to load
        Pause 12
        'Save As in Explorer
        SendKeys "%FA", True
        'Pause 2
        'Enter the filename
        SendKeys strFilename, True
        'Press Enter
        SendKeys "{ENTER}", True
        Pause 15
        'Close Explorer
        SendKeys "%FC", True
    Here is the code for the Pause procedure:

    Public Sub Pause(sinSeconds As Single)
    'Description :      This procedure will 'pause' execution of the program for the specified number of
    '                   seconds
    'Parameters :       sinSeconds      Number of seconds to pause, can be a fraction.
    'Return :           None.
        Dim sinStartTime As Single
        Dim sinFinishTime As Single
        Dim lngCount As Long
        'Get the current number of seconds since the beginning of the day
        sinStartTime = Timer
        sinFinishTime = sinStartTime + sinSeconds
        'Adjust for midnight
        If sinFinishTime > 86400 Then sinFinishTime = sinFinishTime - 86400
        Do Until Timer > sinFinishTime
            lngCount = 0
    End Sub

Posting Permissions

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