drom
Well-known Member
- Joined
- Mar 20, 2005
- Messages
- 543
- Office Version
- 2021
- 2019
- 2016
- 2013
- 2011
- 2010
- 2007
Hi and Thanks in advance!
I few days ago I posted the following question:
I am trying to isert a picture in a cell (like in my previous question)
The picture exists:
But I do not know why when I copy and paste the previous address in google the previous address becomes:
So When I am trying to get the picture from the website using the macro (I get the err 1004, because the picture does not exit with the 97 address
How can I solve this??
I few days ago I posted the following question:
Already solved
now I am having a different problem:I am trying to isert a picture in a cell (like in my previous question)
The picture exists:
But I do not know why when I copy and paste the previous address in google the previous address becomes:
So When I am trying to get the picture from the website using the macro (I get the err 1004, because the picture does not exit with the 97 address
VBA Code:
Sub mToInsertURLpicture()
On Error Resume Next: Application.ScreenUpdating = False
Dim WKBvba As Workbook: Set WKBvba = ThisWorkbook
Dim WKBactive As Workbook: Set WKBactive = ActiveWorkbook
Dim wActSht As String: wActSht = ActiveSheet.Name
Dim rCell As Range: Set rCell = ActiveCell
Dim wURL As String: wURL = rCell
Dim Pic As Picture
Dim Shp As Shape
wURL = "https://casdocs.com/CASAS/01758-97.jpg"
Err.Clear
'rCell.Select
If wURL <> "" Then
If Left(LCase(wURL), 4) = "http" Then '://" Or Left(LCase(wURL), 8) = "https://" Then
Err.Clear
Set Pic = Nothing: Set Pic = Sheets(wActSht).Pictures.Insert(wURL)
If Pic Is Nothing Then
Set Pic = Nothing: Set Pic = Sheets(wActSht).Pictures.Insert(UCase(wURL))
End If
If Pic Is Nothing Then
Set Pic = Nothing: Set Pic = Sheets(wActSht).Pictures.Insert(Left(LCase(wURL), Len(wURL) - 4) & UCase(Right(wURL, 4)))
End If
If Pic Is Nothing Then
MsgBox "Wrong" & vbNewLine, vbCritical, "Thanks in advance!"
Else
MsgBox "OK" & vbNewLine, vbInformation, "Thanks in advance!"
End If
End If
End If
End Sub
How can I solve this??