Hi all,
Hoping someone can help me figure out a solution - ive checked a few posts and cant seem to get the right bits for what i need to figure this out myself
I currently have this VBA code that works perfectly, however, if others are wanting to use this report, as they dont have access to my local folder, they cant run the report.
Current code
Ive used Sharepoint.source (iirc) text before on different projects ( maybe that was in power query im not sure), but cant seem to get this to work as it generates the file path from cells within the report to help navigate to the desired photo and import.
i understand that i need to change the "\" to "/" which i had done - maybe its because my tp+typ strings dont cater for the spaces in a URL that are changed to %20?
a solution would be appreciated
Hoping someone can help me figure out a solution - ive checked a few posts and cant seem to get the right bits for what i need to figure this out myself
I currently have this VBA code that works perfectly, however, if others are wanting to use this report, as they dont have access to my local folder, they cant run the report.
Current code
VBA Code:
Sub InsertPictures()
Const fPath = "C:\Users\Me\Site\folder1\folder2\folder3\Photos"
Dim cel As Range, picPath As String, tp As String, typ As String
Dim pRng As Range
Dim filename As String
tp= Range("a2").Value
typ= Range("a3").Value
For Each cel In Range("c4:k4,c7:k7,c10:k10,c13:k13,c16:k16,c19:k19,c22:k22,c25:k25,c28:k28,c31:k31,c34:k34,c37:k37,c40:k40,c43:k43,c46:k46")
picPath = fPath & "\" & tp& "\" & typ & "\" & cel.Value & ".jpg"
If Not Dir(picPath, vbDirectory) = vbNullString Then
With ActiveSheet.Pictures.Insert(picPath)
Set pRng = cel.MergeArea.Offset(1, 0)
With .ShapeRange
.LockAspectRatio = msoFalse
.Left = pRng.Left
.Top = pRng.Top
.Width = pRng.MergeArea.Width
.Height = pRng.MergeArea.Height
End With
End With
End If
Next cel
End Sub
Ive used Sharepoint.source (iirc) text before on different projects ( maybe that was in power query im not sure), but cant seem to get this to work as it generates the file path from cells within the report to help navigate to the desired photo and import.
i understand that i need to change the "\" to "/" which i had done - maybe its because my tp+typ strings dont cater for the spaces in a URL that are changed to %20?
a solution would be appreciated