EXCEL TOOLS
Excel Add-ins ที่พัฒนาโดยคุณสันติพงศ์ ณสุย (MVP Excel 2010-2020) ด้วยภาษา C# เพื่อแก้ไขปัญหาไฟล์ใหญ่ คำนวณนาน ทำงานช้า จัดการข้อมูลต่าง ๆ ที่ทำงานประจำวันได้อย่างสะดวกรวดเร็ว สนใจคลิกไปดูได้ที่นี่ครับ => Excel Tools
Excel Add-ins ที่พัฒนาโดยคุณสันติพงศ์ ณสุย (MVP Excel 2010-2020) ด้วยภาษา C# เพื่อแก้ไขปัญหาไฟล์ใหญ่ คำนวณนาน ทำงานช้า จัดการข้อมูลต่าง ๆ ที่ทำงานประจำวันได้อย่างสะดวกรวดเร็ว สนใจคลิกไปดูได้ที่นี่ครับ => Excel Tools
[code]
และปิดด้วย [/code]
ตัวอย่างเช่น [code]dim r as range[/code]
เพื่อให้แตกต่างจากข้อความทั่วไป สะดวกในการอ่านและทดสอบ (คลิกเพื่อดูตัวอย่าง)Code: Select all
Dim picPath As String
Private Sub Addimage_Click()
'Other code
If sFile <> "" Then
Image1.picture = LoadPicture(sFile)
End If
picPath = sFile
End Sub
Private Sub CommandButton2_Click()
Dim audit_date, auditor, comment, department, place, responce_within, Img As String
Dim rowlast As Integer, imgIcon As Object
'Other code
Sheet2.Range("G" & rowlast).Value = responce_within
With Worksheets("Data Base")
Set imgIcon = .Shapes.AddPicture( _
Filename:=picPath, _
LinkToFile:=False, saveWithDocument:=True, _
Left:=.Cells(rowlast, "c").Left, Top:=.Cells(rowlast, "c").Top, _
Width:=.Cells(rowlast, "c").Width, Height:=.Cells(rowlast, "c").Height)
End With
TextBox1.Text = ""
'Other code
picPath
ครับ หากเป็นค่าว่างแสดงว่าไม่มีการแนบไฟล์ ให้ข้ามไป แต่ถ้าไม่ว่างก็ให้แนบภาพแล้ว Clear ค่าของตัวแปรให้เป็นค่าว่าง ตัวอย่าง Code ตามด้านล่างครับCode: Select all
'Other code
With Worksheets("Data Base")
If picPath <> "" Then
Set imgIcon = .Shapes.AddPicture( _
Filename:=picPath, _
LinkToFile:=False, saveWithDocument:=True, _
Left:=.Cells(rowlast, "c").Left, Top:=.Cells(rowlast, "c").Top, _
Width:=.Cells(rowlast, "c").Width, Height:=.Cells(rowlast, "c").Height)
picPath = ""
End If
End With
'Other code