snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
OptionExplicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$M$5" Then
If Range("c10").Value = "PM TOP PUNCH" Then
MsgBox "Please call Tool Room"
End If
End If
End Sub
ขอบคุณมากครับ สำหรับความฝันของผมจะเป็นจริงได้
อยากให้เปิดไฟล์มาถ้าเจอคำว่า PM TOP PUNCH ในคอลัมพ์ C อย่างน้อย 1 ตัวขึ้นไป จะให้มันป้อบอัพขึ้นมา ผมจะต้องแก้ไขโค้ดอย่างไร ผมลองเขียนโค้ดแบบนี้ มา
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$M$5" Then
If Range("c10").Value = "PM TOP PUNCH" Then
MsgBox "Please call Tool Room"
End If
End If
End Sub
Sub EmailFromExcel()
On Error GoTo PROC_EXIT
Dim OL As New Outlook.Application
Dim olMail As Outlook.MailItem
Set olMail = OL.CreateItem(olMailItem)
Dim SrcSheet As Excel.Worksheet
Set SrcSheet = Sheets("StatusPage")
With olMail
.To = SrcSheet.Range("n3").Text + "@intriplex.co.th"
.Subject = "Some documents are awaiting for approval."
.Body = "Dear all concern, " & vbCrLf & vbCrLf & vbTab & _
"Please consider to review and approve your document as link : file:///\\srv-05\Document_Control$\XX-Draft\DOC_APPROVE_STATUS\CheckOnStatus.xlsm" & vbCrLf & vbCrLf & _
"Best regards," & vbCrLf & vbCrLf & _
"Supaporn Klamthapthiraphon " & vbCrLf & _
"Executive, Document Control " & vbCrLf & _
"Precision Forming Group " & vbCrLf & vbCrLf & _
"IntriPlex (Thailand) Ltd " & vbCrLf & _
"158-160 Moo 1, Hi-Tech Industrial Estate, " & vbCrLf & _
"T. Baanlane, A. Bangpa-in " & vbCrLf & _
"Ayutthaya 13160 Thailand " & vbCrLf & vbCrLf & _
"T : +66 (0) 35 729 183 " & vbCrLf & _
"M: +66 (0) 86 089 9861 " & vbCrLf & _
"F : +66 (0) 35 729 192 " & vbCrLf & _
"www.mmi.com.sg " & vbCrLf & vbCrLf & _
"This message may contain confidential or privileged information intended only for the use of the addressee(s) named above. If you are not the intended recipient of this message, you are not to use, disseminate, distribute or reproduce this message contained herein to anyone. If you have received this email in error, please notify the sender and delete this message. Thank You."
.Display vbModal
'.Send
End With
PROC_EXIT:
On Error GoTo 0
OL.Quit
Set OL = Nothing
End Sub