標題:
[發問]
由於MsgBox內容過長會顯示異常,請問如何將程式改寫成UserForm的TextBox?
[打印本頁]
作者:
av8d
時間:
2012-6-23 16:33
標題:
由於MsgBox內容過長會顯示異常,請問如何將程式改寫成UserForm的TextBox?
本帖最後由 av8d 於 2012-6-24 19:29 編輯
由於MsgBox內容過長會顯示異常,聽說TextBox既可以延伸又可以複製貼,請問如何將程式改寫成UserForm的TextBox視窗?
Sub Music()
Dim J1%, S1$, S2$
With 工作表2.WindowsMediaPlayer1 '加入MediaPlayer播放音樂
.URL = "D:\數羊歌.mp3" '請修改音樂檔案
.Visible = False
.Controls.stop
End With
For J1 = 4 To Sheets("Data").[A65536].End(xlUp).Row
If Range("A" & J1) <> "" And IsDate(Range("A" & J1)) Then
''''''''''''''''''''''''''''''''''''''''''''''''
A1 = DateDiff("D", Date, Range("A" & J1))
If A1 >= 0 And A1 <= 15 Then S1 = "可於【" & (-1) * (A1) & "天】後繳費" & ",繳費金額為【" & Sheets("Data").Range("C" & J1) & "元】"
If A1 <= 10 Then S1 = "可於【" & (-1) * (A1) & "天】後繳費" & ",繳費金額為【" & Sheets("Data").Range("C" & J1) & "元】"
If A1 <= 5 Then S1 = "可於【" & (-1) * (A1) & "天】後繳費" & ",繳費金額為【" & Sheets("Data").Range("C" & J1) & "元】"
'If A1 < 0 Then S1 = "已過期" & (-1) * (A1) & "天"
If S1 <> "" Then S2 = S2 & "您有一筆於【" & Sheets("Data").Range("A" & J1) & "】消費的【" & Sheets("Data").Range("D" & J1) & "】費用," & S1 & vbNewLine & vbNewLine
S1 = "": A1 = 0
'''''''''''''''''''''''''''''''''''''''''''
End If
Next
If S2 <> "" Then
With 工作表2.WindowsMediaPlayer1 '加入MediaPlayer播放音樂
.URL = "D:\數羊歌.mp3" '請修改音樂檔案
.Visible = False
.Controls.Play '播放音樂
''''''''''''''''''''''''''''''''''''
MsgBox S2
.Controls.stop '關閉音樂
'''''''''''''''''''''''''''''''''
End With
End If
End Sub
複製代碼
作者:
hugh0620
時間:
2012-6-28 18:42
回復
1#
av8d
MsgBox S2
用userform+textbox
With UserForm1.TextBox1
.Text = S2
.WordWrap = True
.Enabled = False
End With
UserForm1.Show
這樣就可以了
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)