
nombre y tamaño macro qr
Publicado por andres (6 intervenciones) el 08/12/2022 16:28:10
Muy buen dia actualmente tengo un excel el cual genero un qr (con la api de google )en una carpeta , el problema es que no se como poder colocarle el nombre a la imagen que corresponda a la celda B , agradezco cualquier ayuda que me puedan brindar.
--codigo
Function QRCODE(codeText As String)
Dim objXML, Url As String, imgFile As String
Dim xStrImgName As String
Set objXML = CreateObject("Microsoft.XMLHttp")
Url = "https://chart.googleapis.com/chart?chs=250x250&cht=qr&chl=" & codeText
objXML.Open "Get", Url, False
objXML.Send
' quiero que ese range ("b2") sea automático y tome el valor que tenga en la celda
imgFile = CreateObject("wscript.shell").specialfolders("desktop") & "\QR_Imagen\" & _
Format(Now, "yyyymmdd") & Range("b2") & ".png"
With CreateObject("ADODB.Stream")
.Type = 1
.Open
.Write objXML.ResponseBody
.SaveToFile imgFile, 2
.Close
End With
QRCODE = imgFile
End Function

--codigo
Function QRCODE(codeText As String)
Dim objXML, Url As String, imgFile As String
Dim xStrImgName As String
Set objXML = CreateObject("Microsoft.XMLHttp")
Url = "https://chart.googleapis.com/chart?chs=250x250&cht=qr&chl=" & codeText
objXML.Open "Get", Url, False
objXML.Send
' quiero que ese range ("b2") sea automático y tome el valor que tenga en la celda
imgFile = CreateObject("wscript.shell").specialfolders("desktop") & "\QR_Imagen\" & _
Format(Now, "yyyymmdd") & Range("b2") & ".png"
With CreateObject("ADODB.Stream")
.Type = 1
.Open
.Write objXML.ResponseBody
.SaveToFile imgFile, 2
.Close
End With
QRCODE = imgFile
End Function
Valora esta pregunta


0