ผมเชื่อมต่อ line notify เพื่อให้แสดงค่าปริมาณไม้ที่เบิกต่อวันในแต่ละประเภท
แต่การแสดงผลใน line notify ให้ค่าไม่ครบทุกตัวอักษร เป็นแบบนี้สามารถแก้ไข VBA หรือ API ตรงไหนเพื่อให้แสดงค่าได้ครบได้บ้างครับ
ตัวอย่างโค๊ดที่เขียนมา
Code: Select all
'Code Line Notify V2
Sub Sendline()
Dim S As Worksheet
Dim LOL As String
Dim R As Integer
Dim X As String
Dim A1 As String
Dim A2 As String
Dim A3 As String
Dim A4 As String
Dim B1, B2, B3, B4, Y As Long
Set S = ThisWorkbook.Sheets("เบิกไม้")
R = S.Range("B2", S.Range("B2").End(xlDown)).Rows.Count + 1
For i = 4 To R
If S.Cells(i, 7).Value = "อบ" Then
X = S.Cells(i, 20)
A1 = A1 + X + " "
Y = S.Cells(i, 9).Value
B1 = B1 + Y
ElseIf S.Cells(i, 7).Value = "ขาย" Then
X = S.Cells(i, 20)
A2 = A2 + X + " "
Y = S.Cells(i, 9).Value
B2 = B2 + Y
ElseIf S.Cells(i, 7).Value = "ผ่า" Then
X = S.Cells(i, 20) & S.Cells(i, 9) & " "
A3 = " " + A3 + X
Y = S.Cells(i, 9).Value
B3 = B3 + Y
ElseIf S.Cells(i, 7).Value = "แปลง" Then
X = S.Cells(i, 20)
A4 = A4 + X + " "
Y = S.Cells(i, 9).Value
B4 = B4 + Y
End If
Next i
Debug.Print (A3)
Call LineNotify(A3, 0, 0)
End Sub
Sub LineNotify(msg As String, Optional stickID As Integer, Optional stickPack As Integer)
Dim LineToken As String
Dim lineMessage As String
Dim objectXML As Object
Dim URL As String
'Line Notify Token ที่ Generate มา
LineToken = "ไลน์โทเค่น"
'Line Message
'yourMessage = msg
lineMessage = "message=" & msg
'เพิ่มเงื่อนไข Sticker
If stickPack = 0 Or stickID = 0 Then
Else
lineMessage = lineMessage & "&stickerPackageId=" & stickPack & "&stickerId=" & stickID
End If
Set objectXML = CreateObject("Microsoft.XMLHTTP")
URL = "https://notify-api.line.me/api/notify"
With objectXML
.Open "POST", URL, 0
.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.SetRequestHeader "Authorization", "Bearer " & LineToken
.send (lineMessage)
' Debug.Print objectXML.responseText
End With
Set objectXML = Nothing
End Sub
รบกวนท่านผู้รู้ด้วยนะครับ
ปล.ไม่ได้ใส่ Line Token ไปนะครับ
รายละเอียดคลังไม้ท่อน 29-7-2563.xlsm
You do not have the required permissions to view the files attached to this post.