|
* 답변하시는 분들께 도움이 되도록 자신의 환경을 아래 항목 옆에 기재해 주세요.
- 엑셀 버전(95,97,2000,xp,2003,2007):2013
* 아래줄에 질문을 작성하세요 >>
A열에 데이타를 넣어면 VBA를 통해서 qr코드가 생성되게 했습니다.
근데 이때 QR이미지가 계속 생겨나요. 덮어서.....
이전꺼 지우면서 qr이미지 하나만 남게 하는 방법좀 알려주세요.
=> 엑셀에서 qr코드를 쉽게 생성하는 방법좀 알려주십시요.
==============[소리새님 글에 대한 답변입니다]==============
Function QRCode(txt As String, Optional width As Integer = 60, Optional height As Integer = 60)
Dim r As Long
Dim c As Integer
r = Application.Caller.Row
c = Application.Caller.Column
encodedTxt = ENCURI(txt)
'-------------------------------------------------------------------
' 이부분은 삭제하시고
아래와 같이 하면 해당시트의 모든 그림파일을 지우고 새로생성합니다.
'On Error Resume Next
'ActiveSheet.Pictures(encodedTxt).Delete
'On Error GoTo 0
'-------------------------------------------------------------------
' 이부분을 추가하세요.
For Each pic In ActiveSheet.Pictures
pic.Delete
Next
'-------------------------------------------------------------------
With ActiveSheet.Pictures.Insert("https://zxing.org/w/chart?cht=qr&chs=350x350&chld=L&choe=UTF-8&chl=" + encodedTxt)
.Name = txt
r = Application.Caller.Row
c = Application.Caller.Column
.Left = ActiveSheet.Cells(r, c).Left
.Top = ActiveSheet.Cells(r, c).Top
.width = width
.height = height
.ShapeRange.ZOrder (msoBringToFront)
End With
QRCode = ""
End Function
|
|