Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VBA FTP

VBA FTP

Scheduled Pinned Locked Moved Visual Basic
hardwarexmlhelpquestion
6 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dalek Dave
    wrote on last edited by
    #1

    I am attempting to write a macro so that within an Excel Worksheet I call it, and it saves the .xlsm, saves as a web page and then opens the ftp (in this case filezilla). I am now stuck. Where I want to go with this is that the ftpclient automatically opens on the correct website. (We have several) After that I am happy to select the files to upload and close. I have embedded a hyperlink in the file at cell A1. I suspect that I may need to somehow put the host/username/password into the macro somewhere and get it called on the call of the ftpclient. Can anybody suggest where I am going wrong?

    Sub Macro2()
    '
    ' Macro2 Macro
    '

    '
    ActiveWorkbook.SaveAs Filename:="C:\Users\David\Desktop\Book1.xlsm", _
    FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
    Application.DisplayAlerts = False
    With ActiveWorkbook.PublishObjects.Add(xlSourceWorkbook, _
    "C:\Users\David\Desktop\Book1.htm", , , xlHtmlStatic, "Book1_31795", "")
    .Publish (True)
    .AutoRepublish = True
    Application.DisplayAlerts = True
    End With
    Application.Left = 161.5
    Application.Top = 91.75
    Range("a1").Select
    Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
    End Sub

    ------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC League Table Link CCC Link[^]

    L 1 Reply Last reply
    0
    • D Dalek Dave

      I am attempting to write a macro so that within an Excel Worksheet I call it, and it saves the .xlsm, saves as a web page and then opens the ftp (in this case filezilla). I am now stuck. Where I want to go with this is that the ftpclient automatically opens on the correct website. (We have several) After that I am happy to select the files to upload and close. I have embedded a hyperlink in the file at cell A1. I suspect that I may need to somehow put the host/username/password into the macro somewhere and get it called on the call of the ftpclient. Can anybody suggest where I am going wrong?

      Sub Macro2()
      '
      ' Macro2 Macro
      '

      '
      ActiveWorkbook.SaveAs Filename:="C:\Users\David\Desktop\Book1.xlsm", _
      FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
      Application.DisplayAlerts = False
      With ActiveWorkbook.PublishObjects.Add(xlSourceWorkbook, _
      "C:\Users\David\Desktop\Book1.htm", , , xlHtmlStatic, "Book1_31795", "")
      .Publish (True)
      .AutoRepublish = True
      Application.DisplayAlerts = True
      End With
      Application.Left = 161.5
      Application.Top = 91.75
      Range("a1").Select
      Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
      End Sub

      ------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC League Table Link CCC Link[^]

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hoi, this[^] suggests one can invoke FileZilla client with a specific target website in mind, so if your VBA powers allow you to execute an arbitrary "DOS command", I'd go for it. Alternatively, you could use a different FTP client, e.g. the one provided by (some versions of?) Windows, see here[^]. I expect those FTP clients will still prompt you for username and password. :)

      Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

      D 1 Reply Last reply
      0
      • L Luc Pattyn

        Hoi, this[^] suggests one can invoke FileZilla client with a specific target website in mind, so if your VBA powers allow you to execute an arbitrary "DOS command", I'd go for it. Alternatively, you could use a different FTP client, e.g. the one provided by (some versions of?) Windows, see here[^]. I expect those FTP clients will still prompt you for username and password. :)

        Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

        Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

        D Offline
        D Offline
        Dalek Dave
        wrote on last edited by
        #3

        OK, as far as I can tell I need to open a dos shell and call a batch file. Is that right? Call the shell as: Shell ftp.bat",vbnormalfocus Batch file to look something like: filezilla ftp://username:password@server:port As far as I can tell this will open the command shell, then run the batch file ftp.bat which will call FileZilla and apply the necessary data to expose the website. Is this right?

        ------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC League Table Link CCC Link[^]

        L S 2 Replies Last reply
        0
        • D Dalek Dave

          OK, as far as I can tell I need to open a dos shell and call a batch file. Is that right? Call the shell as: Shell ftp.bat",vbnormalfocus Batch file to look something like: filezilla ftp://username:password@server:port As far as I can tell this will open the command shell, then run the batch file ftp.bat which will call FileZilla and apply the necessary data to expose the website. Is this right?

          ------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC League Table Link CCC Link[^]

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          I don't know the details, as I avoid VB6 and VBA as much as possible. I don't think you need a batch file, although it could make sense to have it anyway. I would read up on, and experiment with, things like this:

          Call Shell("cmd /K FileZilla whatever_constant_arguments_you_want_to_provide" & or_variable_arguments, vbNormalFocus)

          or maybe simply:

          Call Shell("FileZilla whatever_constant_arguments_you_want_to_provide" & or_variable_arguments, vbNormalFocus)

          :)

          Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

          Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

          1 Reply Last reply
          0
          • D Dalek Dave

            OK, as far as I can tell I need to open a dos shell and call a batch file. Is that right? Call the shell as: Shell ftp.bat",vbnormalfocus Batch file to look something like: filezilla ftp://username:password@server:port As far as I can tell this will open the command shell, then run the batch file ftp.bat which will call FileZilla and apply the necessary data to expose the website. Is this right?

            ------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC League Table Link CCC Link[^]

            S Offline
            S Offline
            shreekar
            wrote on last edited by
            #5

            A word of caution: Make sure filezilla.exe is in the PATH variable. Or You provide absolute path to the filezilla exe Or You place the bat file in the correct location with relation to how you have called the filezilla exe.

            Shreekar

            D 1 Reply Last reply
            0
            • S shreekar

              A word of caution: Make sure filezilla.exe is in the PATH variable. Or You provide absolute path to the filezilla exe Or You place the bat file in the correct location with relation to how you have called the filezilla exe.

              Shreekar

              D Offline
              D Offline
              Dalek Dave
              wrote on last edited by
              #6

              Thanks for the advice.

              ------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC League Table Link CCC Link[^]

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups