Consulting

Results 1 to 1 of 1

Thread: How to add file string in Input Box from the "Choose a File to Upload" Dialog Box

  1. #1
    VBAX Newbie
    Joined
    Apr 2019
    Posts
    1
    Location

    How to add file string in Input Box from the "Choose a File to Upload" Dialog Box

    'Get source file As a string.
        FileLink = Path & File
        
    'Define URL:
      URL = Defined
        
      IEpath = """C:\Windows\SysWOW64\shell32.dll"""
          
    'initiating a new instance of Internet Explorer and assigning it to objIE
        Set objIE = New InternetExplorer
        Set Doc = objIE.Document
     
    'make IE browser visible (False would allow IE to run in the background)
        objIE.Visible = True
        
    'navigate to web page
        objIE.Navigate URL
    
    
    'wait while the browser is loading
        Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
        
    'WebPage loaded
        Shell (IEpath & URL)
      
    'in the select option attach the csv file
        Set Click = objIE.Document.GetActiveBrowserObj
    
    'click the 'fileupload0' to select
        objIE.Document.getelementbyid("fileupload0").Click
    
     'HERE IS WHERE I NEED HELP WITH, TO ADD THE FILE STRING WITHOUT USER'S INTERACTION  ....   
    'InputBox asks the user to enter a value in a dialog box
    
    'Get Window ID for IE so we can set it as activate window
    HWNDScrn = objIE.hwnd  'Handle to a Window Screen
    
    'Set IE ID as active Window
    Application.GetWindowText (HWNDScrn)
    'Application.SetForegroundWindow (HWNDScrn)
    
    'If objIE.Document.ShowDialog = Windows.Forms.DialogResult.OK Then
    '    objIE.form.TextBox1.Text = objIE.form.GetDirectoryName(FileLink.FileName) 'file content goes here
    '
    'End If
    
    If objIE.xFiDialog.Show = -1 Then
    
    If Application.xFiDialog(xlDialogInsertHyperlink).Show Then
    
    End If
    '----------------------------------------------------------------------------
     
    'Upload IE
     ' PushKeys (FileLink) 'enter link to web app
      objIE.Document.FormInputTypeFile.Action = "Load"
    Last edited by Sussy; 04-16-2019 at 07:19 AM. Reason: Added code tags

Posting Permissions

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