Solved Web Browser Control Save Image

oxicottin

Learning by pecking away....
Local time
Today, 01:36
Joined
Jun 26, 2007
Messages
883
Hello, I'm using Googles https://chart.googleapis.com/chart? to be able to get QR codes from a text box [Text2] and it works just fine. I now need to be able to save the QR code to my desktop using a button. I currently found the code below HERE, but it brings up a open file window and allows me to name the image and where to save it at but I don't want to-do all that I wanted to just be able to click the button and it auto save to desktop. How can I do this?

="https://chart.googleapis.com/chart?chl=" & [Text2] & "&chs=200x200&cht=qr"

Code:
Private Sub Command10_Click()
  
Dim Path As String
Path = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\"

Me.WebB.Object.ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_DONTPROMPTUSER, Path

End Sub

HERE is the website I'm getting the code....
 

Attachments

Last edited:
@arnelgp I read your example the other day and I cant use it due to having to add/install files to my work PC so I searched for an alternative like in my example I posted. This will allow me to get around all that and anyone could use the .accdb.

Thanks,
 
can you use Excel to import the image?
i added image control.
after importing it (using excel file) to desktop, i assign .Picture property of the image control
to the image on the desktop.
 

Attachments

@arnelgp I wanted to convert to using 128 Code Barcode instead of QR so I figured out how to convert the tables attached excel workbook to be able to retrieve 128 Code Barcodes from a different website because Google doesn't support it and it works. I'm having an error and I cant figure out why, I step through the code and I get to where it wants to create the workbook from the attachment and I get an error in the attached image.

What am I doing wrong? I'm trying to reverse engineer your code but I'm not doing so swell....

error.JPG
 

Attachments

@Gasman the errors code line is in the image its highlighted in yellow....
 
@Gasman the errors code line is in the image its highlighted in yellow....
Yes, I spotted it after posting, but cannot see enough of the code to see what it is related to, recordet I presume?, but I cannot open the DB, my Access is too old, so unable to help. Sorry.

Unsure how you can SaveToFile a recordset field anyway?
 
@arnelgp wrote it hopefully he will jump in and take a look.... Thanks Anyways!
 
Must be something present after 2007? I do not get that option?

1677260149246.png
 
Well if @arnelgp actually wrote that line, then it should work?
All I am saying is in 2007, that Savefile option is not even present?
 
Well if @arnelgp actually wrote that line, then it should work?
All I am saying is in 2007, that Savefile option is not even present?
2007 should have it. Try declaring a DAO.Recordset2 object and assign an Attachment field to it.
 
oxi:
you test this one.
on sub Save128Code(), i comment out the first If statement.
 

Attachments

why not Directly use Excel to create the 128 barcode and create the image from excel
without using the internet.

first you need to "delete" the .xlsm save in Temp folder:
on Immediate window in VBA:

Kill Environ$("temp") & "\qr_code.xlsm"

then open form1. input some numbers (i only limit up to 12 characters the image).

first time it generates the image is slow, since it will need to open Excel.
the succeeding images will be fast.
 

Attachments

2007 should have it. Try declaring a DAO.Recordset2 object and assign an Attachment field to it.
Thanks @theDBguy
I do not have any attachment fields in my DB, so I created one just to test, but still do not get a savefile option?
No big deal as I would never use them normally.

1677342174077.png
 
Thanks @theDBguy
I do not have any attachment fields in my DB, so I created one just to test, but still do not get a savefile option?
No big deal as I would never use them normally.
What do you get if you try it this way?
Code:
rst.Fields("txtAttach").Fields("FileData").save
If you still don't see it with the above, then I would suggest trying it this way.
Code:
Dim db As DAO.Database
Dim rst1 As DAO.Recordset
Dim rst2 As DAO.Recordset2

Set db = CurrentDb()
Set rst1 = db.OpenRecordset("Table3")
Set rst2 = rst1.Fields("txtAttach").Value
rst2.Fields("FileData").SaveToFile strPath
 
For rst.Fields("txtAttach").Fields("FileData").save I get the save changed to Save, but get
1677354770890.png


For the second, that works. (y)

Thank you.
 
For rst.Fields("txtAttach").Fields("FileData").save I get the save changed to Save, but get
View attachment 106666

For the second, that works. (y)

Thank you.
Sorry, I only wrote "save" hoping that you would see the rest of the method in Intellisense, which was supposed to be "SaveToFile." :)

Glad to hear you got the other approach to work. I knew it was available in 2007. Cheers!
 

Users who are viewing this thread

Back
Top Bottom