Page 1 of 1
การแทรกรูป ใน excel
Posted: Mon Oct 18, 2021 7:27 pm
by kook001
สวัสดีครับ ผมได้ทำการแทรกรูป ใน excel แต่พอ save เเละทำไฟล์ไปส่งต่อ เปิดมารูปไม่ขึ้นครับ
ต้องแก้ไขอย่างไรดีครับ (โดยเราจะไม่ส่ง folder รูปไปให้ด้วย)...ขอบคุณครับ
Re: การแทรกรูป ใน excel
Posted: Mon Oct 18, 2021 8:57 pm
by snasui

ช่วยแจ้งวิธีการแทรกประกอบมาด้วยครับ
Re: การแทรกรูป ใน excel
Posted: Mon Oct 18, 2021 9:42 pm
by kook001
ผมเขียน vba upload รูปครับ
Re: การแทรกรูป ใน excel
Posted: Mon Oct 18, 2021 9:58 pm
by snasui

ปกติการนำรูปมาแสดง รูปนั้นจะต้องอยู่ที่คอมพิวเตอร์ส่วนกลางที่พร้อมจะนำไปแสดงที่เครื่องใดก็ได้ครับ
ควรแนบไฟล์ตัวอย่างพร้อม Code ที่เขียนมาเองแล้วจะได้ช่วยดูให้ได้
เบื้องต้น ลองตรวจสอบว่าได้ใช้วิธี AddPicture หรือไม่ตามตัวอย่างใน Link นี้ครับ
https://stackoverflow.com/questions/171 ... ed-picture
Re: การแทรกรูป ใน excel
Posted: Mon Oct 18, 2021 10:15 pm
by kook001
Sub Button_upload()
Dim sPicture As String, pic As Picture
sPicture = Application.GetOpenFilename _
("Pictures (*.gif; *.jpg; *.bmp; *.tif), *.gif; *.jpg; *.bmp; *.tif", _
, "please select picture as you want")
If sPicture = "False" Then Exit Sub
Set pic = ActiveSheet.Pictures.Insert(sPicture)
With pic
.ShapeRange.LockAspectRatio = msoFalse
.Height = ActiveCell.Height
.Width = ActiveCell.Width
.Top = ActiveCell.Top
.Left = ActiveCell.Left
.Placement = xlMoveAndSize
End With
Set pic = Nothing
End Sub
Re: การแทรกรูป ใน excel
Posted: Mon Oct 18, 2021 10:22 pm
by snasui

Code ที่แนบมานั้นควรมีรูปแบบตัวอักษรเป็น Code กรุณาอ่านกฎการใช้บอร์ดข้อ 5 ด้านบนประกอบครับ
ควรแนบไฟล์มาพร้อม Code ทั้งไฟล์ภาพและไฟล์ Excel ที่เขียน Code เอาไว้แล้ว จะได้ช่วยทดสอบให้ได้ครับ
Re: การแทรกรูป ใน excel
Posted: Mon Oct 18, 2021 11:31 pm
by kook001
ขอบคุณครับ ใช้ส่งเแบบ pdf แทน ครับ ขอบคุณครับ