Format QR changeant
J
Bonjour,
J'ai trouvé ce code sur le web qui fonctionne très bien sur mon fichier, mais j'ai un petit soucis de format.
Quand j'actualise ou qu'elle se met à jour pour une modif, le QR change de taille (pas le format général mais seulementy le QR)
Je voulais savoir ou il fallait que je modifie pour que la taille du QR reste fixe
Voici le code en question :
Function URL_QRCode_SERIES( _
ByVal QR_Value As String, _
Optional ByVal PictureSize As Long = 100, _
Optional ByVal DisplayText As String = "QR", _
Optional ByVal Updateable As Boolean = True) As Variant
Dim PictureName As String
Dim oPic As Shape, oRng As Excel.Range
Dim vLeft As Variant, vTop As Variant
Dim sURL As String
Const sRootURL As String = "https://chart.googleapis.com/chart?"
Const sSizeParameter As String = "chs="
Const sTypeChart As String = "cht=qr"
Const sDataParameter As String = "chl="
Const sJoinCHR As String = "&"
If Updateable = False Then
URL_QRCode_SERIES = "outdated"
Exit Function
End If
PictureName = "QRCode" & Application.Caller.Address
Set oRng = Application.Caller.Offset(, 1)
On Error Resume Next
Set oPic = oRng.Parent.Shapes(PictureName)
If Err Then
Err.Clear
vLeft = oRng.Left + 4
vTop = oRng.Top
Else
vLeft = oPic.Left
vTop = oPic.Top
PictureSize = Int(oPic.Width)
oPic.Delete
End If
On Error GoTo 0
If Len(QR_Value) = 0 Then
URL_QRCode_SERIES = CVErr(xlErrValue)
Exit Function
End If
sURL = sRootURL & _
sSizeParameter & PictureSize & "x" & PictureSize & sJoinCHR & _
sTypeChart & sJoinCHR & _
sDataParameter & UTF8_URL_Encode(VBA.Replace(QR_Value, " ", "+"))
Set oPic = oRng.Parent.Shapes.AddPicture(sURL, True, True, vLeft, vTop, PictureSize, PictureSize)
oPic.Name = PictureName
URL_QRCode_SERIES = DisplayText
End Function
Exemple de taille différente
J
Je pense que ça doit jouer dans le picture size mais je ne sais pas trop déterminé...
Si on pouvait enlever en même temps la "marge" blanche autour, ce serait parfait