1

I succesfully created a VBA sub to import a VBA module from a local file with code like

sImportFile = "C:\temp\Module.bas"

ThisWorkbook.VBProject.VBComponents.Import sImportFile

For update reasons the file should be on the web, for example

sImportFile =  "http://mywebsite.org/download/Module.bas"

But then I'm getting a Path/File access error (Error 75). The download folder is not protected. How to import from an URL?

Community
  • 1
  • 1
Ben Welman
  • 301
  • 2
  • 4
  • 5
    Download to local temporary folder, import and delete temporary file. `.Import` cannot download files. – Pᴇʜ Mar 20 '18 at 13:43

1 Answers1

3

How to import from an URL?

You don't. You download the file to your local file system, and provide VBComponents.Import with the path to the local file.

You can find out how to download a file from a URL with an HTTP request right here on SO.

Mathieu Guindon
  • 69,817
  • 8
  • 107
  • 235