+ Reply to Thread
Results 1 to 6 of 6

In depth FTP question.

  1. #1
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    In depth FTP question.

    I'm using the following code (found elsewhere in this forum) to upload a temp file to an ftp site:

    Please Login or Register  to view this content.

    It works perfectly.

    However, is there a way I can specify a sub directory of my ftp server? I've tried hostfile = "\\subdir\subdir\filename" but then I just get a weird file in the root of the ftp server called \\subdir\subdir\filename.


    Thanks in advance.
    Last edited by swoop99; 01-20-2012 at 12:39 PM.

  2. #2
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: In depth FTP question.

    No-one knows?

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: In depth FTP question.

    Hi swoop99,

    I have no idea BUT....

    Put an Option Explicit above your code and see if it compiles. The reason is that you have the Dim hostfile as String remarked out in your code above.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: In depth FTP question.

    Ah yes, the curious thing was after I'd cut and paste the code above from this forum into my module and ran it to test if it worked I got an error saying 'duplicate declaration' on that line. So I rem'd out the dim and it worked fine even though I'm damned if I can see a duplicate dim anywhere.

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: In depth FTP question.

    But why so complicated.
    Excel has a builtin facility to put any file on a webserver.

    You can add that location as an FTP-location in the SaveAs subwindow (scroll down completely).
    After having added the location you can ftp any workbook using

    Please Login or Register  to view this content.
    Last edited by snb; 01-22-2012 at 09:00 AM.



  6. #6
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: In depth FTP question.

    Firstly, I dont want to upload the workbook (it's 32mb), I need to upload another workbook that's temporarily created with data in it and then deleted after the ftp upload.

    Secondly, it needs to happen with no user intervention to a secure location and the one line command you list above suggests users would need to input username and password. EDIT: Oh and to prevent users screwing around with my workbook I've disabled 'saveas' and placed code in various places to ensure the workbook is always opened as read only and even if it is open with read/write access it'll make sure the loading screen is selected if someone saves it.

    And thirdly, I had no idea the facility existed until you posted.
    Last edited by swoop99; 01-22-2012 at 09:22 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1