My end goal is to have a system where I can apply tags with QR codes on parts of large machines so that it is easier to identify a part if it needs to be replaced.
I have a lot of spreadsheets with different layouts that I have to draw from so I am currently taking some user inputs.
There are three things per part I want generated from my spreadsheets. The tag to put on the part, the html file for the web server, and the qr code in .png format.
In excel I have already written equations to generate the html for the tags and the information file. I also have equations that link the Google's Qr generator.
I have gotten my code to generate the html file from my excel spreadsheet and I don't think I will have too much trouble with the part tags once I get the QR picture.
My code generates them, but they are not in any cells. They are just placed on the sheet itself. If I could just take the picture and generate .png files without even putting them in the cell that is fine too.
I'm sorry if this isn't very straight forward. If you have questions I will do my best to answer them for you.
Here is an example of one of the QR links
https://chart.googleapis.com/chart?...l=http://172.28.5.67/Pilot Gas Solenoid Valve
I have tried so many different ways to do this, I cannot remember which code gave me the best results
With this code I had trouble accommodating the different excel templates by having a variable range.
When I set the range for a test case it generated the right pictures in excel, but just on the sheet and not in the cell I wanted.
I also don't have any clue how I will save the pictures to individual files if it isn't the same way as I did for text.
Sub CreateFiles()
Dim Pic As Picture
Row = Application.InputBox("What Row Does the Data Start on?", "Input Box Text", Type:=2)
Name = Application.InputBox("What Column Letter Are the Part Names On?", "Input Box Text", Type:=2)
HTML = Application.InputBox("What Column Letter Are the HTML codes on?", "Input Box Text", Type:=2)
Link = Application.InputBox("What Column Letter Are the QR links on?", "Input Box Text", Type:=2)
Jump1 = ActiveSheet.Range("" & HTML & Row).Column - ActiveSheet.Range("" & Name & Row).Column
Jump2 = ActiveSheet.Range("" & Link & Row).Column - ActiveSheet.Range("" & Name & Row).Column
Range("" & Name & Row).Activate
Do While Not IsEmpty(ActiveCell.Offset(0, 1))
MyFile = ActiveCell.Value & ".txt"
fnum = FreeFile()
Open MyFile For Output As fnum
Print #fnum, ActiveCell(0, Jump1)
Close #fnum
Application.ScreenUpdating = False
With ActiveSheet.Range("ActiveCell(0,Jump2")
Set Pic = .Parent.Pictures.Insert(.Value)
With .Offset(, 1)
Pic.Top = .Top
Pic.Left = .Left
Pic.Height = .Height
Pic.Width = .Width
End With
End With
Application.ScreenUpdating = True
ActiveCell.Offset(1, 0).Select
Loop
MsgBox "finished"
End Sub
I have a lot of spreadsheets with different layouts that I have to draw from so I am currently taking some user inputs.
There are three things per part I want generated from my spreadsheets. The tag to put on the part, the html file for the web server, and the qr code in .png format.
In excel I have already written equations to generate the html for the tags and the information file. I also have equations that link the Google's Qr generator.
I have gotten my code to generate the html file from my excel spreadsheet and I don't think I will have too much trouble with the part tags once I get the QR picture.
My code generates them, but they are not in any cells. They are just placed on the sheet itself. If I could just take the picture and generate .png files without even putting them in the cell that is fine too.
I'm sorry if this isn't very straight forward. If you have questions I will do my best to answer them for you.
Here is an example of one of the QR links
https://chart.googleapis.com/chart?...l=http://172.28.5.67/Pilot Gas Solenoid Valve
I have tried so many different ways to do this, I cannot remember which code gave me the best results
With this code I had trouble accommodating the different excel templates by having a variable range.
When I set the range for a test case it generated the right pictures in excel, but just on the sheet and not in the cell I wanted.
I also don't have any clue how I will save the pictures to individual files if it isn't the same way as I did for text.
Sub CreateFiles()
Dim Pic As Picture
Row = Application.InputBox("What Row Does the Data Start on?", "Input Box Text", Type:=2)
Name = Application.InputBox("What Column Letter Are the Part Names On?", "Input Box Text", Type:=2)
HTML = Application.InputBox("What Column Letter Are the HTML codes on?", "Input Box Text", Type:=2)
Link = Application.InputBox("What Column Letter Are the QR links on?", "Input Box Text", Type:=2)
Jump1 = ActiveSheet.Range("" & HTML & Row).Column - ActiveSheet.Range("" & Name & Row).Column
Jump2 = ActiveSheet.Range("" & Link & Row).Column - ActiveSheet.Range("" & Name & Row).Column
Range("" & Name & Row).Activate
Do While Not IsEmpty(ActiveCell.Offset(0, 1))
MyFile = ActiveCell.Value & ".txt"
fnum = FreeFile()
Open MyFile For Output As fnum
Print #fnum, ActiveCell(0, Jump1)
Close #fnum
Application.ScreenUpdating = False
With ActiveSheet.Range("ActiveCell(0,Jump2")
Set Pic = .Parent.Pictures.Insert(.Value)
With .Offset(, 1)
Pic.Top = .Top
Pic.Left = .Left
Pic.Height = .Height
Pic.Width = .Width
End With
End With
Application.ScreenUpdating = True
ActiveCell.Offset(1, 0).Select
Loop
MsgBox "finished"
End Sub