Solved Web Browser Control Save Image (1 Viewer)

oxicottin

Learning by pecking away....
Local time
Today, 04:31
Joined
Jun 26, 2007
Messages
856
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

  • Barcode Database.zip
    49.6 KB · Views: 105
Last edited:

oxicottin

Learning by pecking away....
Local time
Today, 04:31
Joined
Jun 26, 2007
Messages
856
@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,
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:31
Joined
May 7, 2009
Messages
19,245
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

  • Barcode Database.accdb
    620 KB · Views: 107

oxicottin

Learning by pecking away....
Local time
Today, 04:31
Joined
Jun 26, 2007
Messages
856
@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

  • 128_Code_v1.zip
    78.3 KB · Views: 83

oxicottin

Learning by pecking away....
Local time
Today, 04:31
Joined
Jun 26, 2007
Messages
856
@Gasman the errors code line is in the image its highlighted in yellow....
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:31
Joined
Sep 21, 2011
Messages
14,311
@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?
 

oxicottin

Learning by pecking away....
Local time
Today, 04:31
Joined
Jun 26, 2007
Messages
856
@arnelgp wrote it hopefully he will jump in and take a look.... Thanks Anyways!
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:31
Joined
Sep 21, 2011
Messages
14,311
Must be something present after 2007? I do not get that option?

1677260149246.png
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:31
Joined
Sep 21, 2011
Messages
14,311
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?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:31
Joined
Oct 29, 2018
Messages
21,474
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.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:31
Joined
May 7, 2009
Messages
19,245
oxi:
you test this one.
on sub Save128Code(), i comment out the first If statement.
 

Attachments

  • 128_Code_v1.zip
    66.1 KB · Views: 88

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:31
Joined
May 7, 2009
Messages
19,245
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

  • Barcode Database.accdb
    700 KB · Views: 96

Gasman

Enthusiastic Amateur
Local time
Today, 09:31
Joined
Sep 21, 2011
Messages
14,311
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
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:31
Joined
Oct 29, 2018
Messages
21,474
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
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:31
Joined
Sep 21, 2011
Messages
14,311
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.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:31
Joined
Oct 29, 2018
Messages
21,474
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

Top Bottom