• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Upload image using curl in VBA

Hi ,
I also used the code which opens cmd inside the vba to insert a image .But as of now I'm taking the file with the help of filedialog and storing the path in a variable called sfile and I need to pass the value this sfile variable inside curl command. I tried every possible options but it is not substituting the sfile file inside the command.Can you please help me to resolve this. Please find the code below.Error is in the command highlighted below.

>>> use code - tags <<<
Code:
Dim fd As Office.FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
Application.DisplayAlerts = False
Application.EnableEvents = False



With fd
        .Filters.Clear
        .Title = "Select a CSV file to Upload"
        .Filters.Add "CSV", "*.csv", 1
        .AllowMultiSelect = False
    Dim sFile As String
    If .Show = True Then
        sFile = .SelectedItems(1)
    End If

End With


Dim strCmd As String
strCmd = Environ$("comspec") & " /c curl -F fileToUpload=@'$sFile' -H Accept:text/html,application/xhtml+xml,application/xml http://00.000.00.000:0000/data/import_csv/"
Shell strCmd, vbNormalFocus

MsgBox (strCmd)
 
Last edited by a moderator:
Kookie
Please reread Forum Rules
  • Start a new post every time you ask a question, even if the theme is similar. The original author may continue asking questions whilst the post is in progress and of course if you are answering questions you may need to ask questions of the initial poster.
 
Back
Top