I am using Excel macros to drive image changes for a webpage. If I want an image to change on the page, I execute the macro, which grabs the desired image and replaces the file the webpage is using, and the webpage refreshes automatically.
It works perfectly in a local machine, but the intent is for remote users to pull up the webpage and see the new image as I control the macro.
Here is the excel macro:
Sub update_image()
newName = "C:\Cases\Nominal\new_image_to_show.png"
oldName = "C:\Cases\Images\updated_image.png"
FileCopy newName, oldName
End Sub
When I replace the file locations with the web locations, the macro stops working. The web space is an internal location within my organization, and two options I tried were:
newName = "https:://location_of_content\Cases\Nominal\new_image_to_show.png"
oldName = "https:://location_of_content\Cases\Images\updated_image.png"
and
newName = "file://///location_of_content\Cases\Nominal\new_image_to_show.png"
oldName = "file://///location_of_content\Cases\Images\updated_image.png"
I also tried relative path nomenclature,
newName = ThisWorkbook.Path & "\Cases\Nominal\new_image_to_show.png"
but in both cases I get
Run Time Error '52'
Any ideas on how I can rename the paths? Or alternatives to Excel Macros?