0% found this document useful (0 votes)
14 views3 pages

Coding Form

The document is a VBA script for generating barcodes and QR codes in Excel. It includes functions to create barcodes based on user input, save them as JPEG files, and store product information in a worksheet. Additionally, it initializes dropdown menus for product types and units of measure in a user form.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

Coding Form

The document is a VBA script for generating barcodes and QR codes in Excel. It includes functions to create barcodes based on user input, save them as JPEG files, and store product information in a worksheet. Additionally, it initializes dropdown menus for product types and units of measure in a user form.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Option Explicit

Private Sub CMDGENERARE_Click()


Dim Gmb_Barcode, Gmb_QRCode As Shape
Dim SH_Temp1, SH_Temp2 As Worksheet
Dim CH_Temp1, CH_Temp2 As Chart
Dim PicTemp1, PicTemp2 As Picture
[Link] = False

If [Link] = "" Then


Call MsgBox("Harap isi terlebih dahulu kode barang", vbInformation, "Kode Barang")
Else

Select Case MsgBox("Barcode akan dibuat" _


& vbCrLf & "Apakah anda yakin?" _
, vbYesNo Or vbQuestion Or vbDefaultButton1, "Buat Barcode")
Case vbNo
Exit Sub
Case vbYes
End Select
[Link]("C4").Value = [Link]
Set Gmb_Barcode = [Link]("$C$6")
Set Gmb_QRCode = [Link]("$E$6")

Set SH_Temp1 = [Link]


[Link]

[Link] Where:=xlLocationAsObject, Name:=SH_Temp1.Name


Set CH_Temp1 = ActiveChart
Gmb_Barcode.CopyPicture Appearance:=xlScreen, Format:=xlPicture
CH_Temp1.Paste
Set PicTemp1 = Selection
With CH_Temp1.Parent
.Width = 348
.Height = 102
End With
CH_Temp1.Export Filename:="F:\TUTORIAL EXCEL\OFFLINE QR CODE\HASIL\BARCODE\" &
[Link] & ".jpeg"
[Link] = "F:\TUTORIAL EXCEL\OFFLINE QR CODE\HASIL\BARCODE\" &
[Link] & ".jpeg"
[Link] = LoadPicture([Link])

Set SH_Temp2 = [Link]


[Link]
[Link] Where:=xlLocationAsObject, Name:=SH_Temp2.Name
Set CH_Temp2 = ActiveChart
Gmb_QRCode.CopyPicture Appearance:=xlScreen, Format:=xlPicture
CH_Temp2.Paste
Set PicTemp2 = Selection
With CH_Temp2.Parent
.Width = 200
.Height = 200
End With
CH_Temp2.Export Filename:="F:\TUTORIAL EXCEL\OFFLINE QR CODE\HASIL\QRCODE\" &
[Link] & ".jpeg"
[Link] = "F:\TUTORIAL EXCEL\OFFLINE QR CODE\HASIL\QRCODE\" &
[Link] & ".jpeg"
[Link] = LoadPicture([Link])
[Link] = False
SH_Temp1.Delete
SH_Temp2.Delete
[Link] = True
[Link] = True
Call MsgBox("Barcode telah tersimpan di F:\TUTORIAL EXCEL\MEMBUAT BARCODE OTOMATIS\
FILE BARCODE", vbInformation, "Simpan Barcode")
End If
End Sub

Private Sub CMDKODE_Click()


Dim Low As Long
Dim High As Long
Dim Kode As Long
Low = 1
High = 999999999
Kode = Int((High - Low + 1) * Rnd() + Low)
DoEvents
[Link] = "KD-" & Kode

End Sub

Private Sub CMDSIMPAN_Click()


Dim DBBARANG As Object
Set DBBARANG = [Link]("A1000").End(xlUp)
If [Link] = "" _
Or [Link] = "" _
Or [Link] = "" _
Or [Link] = "" _
Or [Link] = "" _
Or [Link] = "" _
Or [Link] = "" Then
Call MsgBox("Harap isi data dengan lengkap", vbInformation, "Isi Data")
Else
[Link](1, 0).Value = "=ROW()-ROW($A$5)"
[Link](1, 1).Value = [Link]
[Link](1, 2).Value = [Link]
[Link](1, 3).Value = [Link]
[Link](1, 4).Value = [Link]
[Link](1, 5).Value = [Link]
[Link](1, 6).Value = [Link]
[Link](1, 7).Value = [Link]

Call MsgBox("Data barang telah disimpan", vbInformation, "Simpan Data")


[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""

[Link] = Nothing
[Link] = Nothing
End If
End Sub

Private Sub CommandButton1_Click()


End Sub

Private Sub UserForm_Initialize()


With CMBJENISBARANG
.AddItem "Elektronik"
.AddItem "Alat Tulis"
.AddItem "Penyimpanan"
End With
With CMBSATUAN
.AddItem "Buah"
.AddItem "PCS"
.AddItem "Kotak"
End With

End Sub

You might also like