기초 레벨업 강의 - 17강
엑셀 QR코드, 무제한 무료로 만드는 쉬운 방법 | 모든 버전 가능
엑셀과 구글에서 무료로 제공하는 QR코드 API를 사용해 무제한, 무료로 QR코드를 만드는 방법을 알아봅니다.🔥
xImage 함수 전체 명령문
함수에 대한 자세한 설명은 관련 게시글을 참고해주세요!🙌
Function xIMAGE(Link, Optional Margin As Long = 0, Optional UpdateImage As Boolean = True)
'###############################################################
'오빠두엑셀 VBA 사용자지정함수 (https://www.oppadu.com)
'수정 및 배포 시 출처를 반드시 명시해야 합니다.
'■ xIMAGE 함수
'■ 인터넷 URL 또는 특정 파일 경로의 이미지를 삽입합니다.
'■ 사용방법
'=xImage("https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png")
'■ 인수 설명
'_____________Link : 웹 URL 또는 파일 경로입니다. 웹 URL일 경우 링크는 반드시 https:// 또는 http:// 로 시작해야 합니다.
'_____________Margin : 셀 안에 삽입할 그림에 여백을 줍니다. 픽셀 단위로 입력합니다. 기본값은 0(=여백없음)입니다.
'_____________UpdateImage : TRUE 일 경우 기존 셀 안에 삽입되어 있던 그림을 삭제하고 새로운 그림으로 갱신합니다. 기본값은 TRUE 입니다.
'###############################################################
Dim aRng As Range: Dim aWS As Worksheet
Dim shpImg As Shape
On Error Resume Next
Set aRng = Application.Caller
Set aWS = aRng.Parent
Application.EnableEvents = False
If IsEmpty(Link) Then xIMAGE = CVErr(xlValue): Exit Function
For Each shpImg In aWS.Shapes
If shpImg.TopLeftCell.Address = aRng.Address Then
If UpdateImage = True Then
shpImg.Delete
Else
xIMAGE = True
GoTo Final
Exit Function
End If
End If
Next
Set shpImg = aWS.Shapes.AddPicture(Link, msoFalse, msoTrue, _
aRng.Left + Margin, aRng.Top + Margin, _
aRng.MergeArea.Width - Margin * 2, aRng.MergeArea.Height - Margin * 2)
shpImg.Placement = xlMoveAndSize
If shpImg Is Nothing Then
xIMAGE = CVErr(xlValue)
Else
xIMAGE = True
End If
Final:
Set shpImg = Nothing: Set aRng = Nothing: Set aWS = Nothing
Application.EnableEvents = True
End Function