Private tempTxt As String
Private Sub Command1_Click()
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
tempTxt = tempTxt + Text1.SelText
Text2.SetFocus
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
tempTxt = tempTxt + Text2.SelText
Text3.SetFocus
Text3.SelStart = 0
Text3.SelLength = Len(Text3.Text)
tempTxt = tempTxt + Text3.SelText
End Sub
Private Sub Command2_Click()
Clipboard.Clear
Clipboard.SetText tempTxt
"Text4.SetFocus
"Text4.Text = Clipboard.GetText
-------------------------------------------------------------------
可以把需要複製文字的文字框定義成控制元件陣列
(將文字框控制元件的名稱設為相同,系統會提示是否建立控制元件陣列,選擇確定)
For i = Text1.LBound To Text1.UBound
Text1(i).SetFocus
Text1(i).SelStart = 0
Text1(i).SelLength = Len(Text1(i).Text)
tempTxt = tempTxt + Text1(i).SelText
Next
Private tempTxt As String
Private Sub Command1_Click()
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
tempTxt = tempTxt + Text1.SelText
Text2.SetFocus
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
tempTxt = tempTxt + Text2.SelText
Text3.SetFocus
Text3.SelStart = 0
Text3.SelLength = Len(Text3.Text)
tempTxt = tempTxt + Text3.SelText
End Sub
Private Sub Command2_Click()
Clipboard.Clear
Clipboard.SetText tempTxt
"Text4.SetFocus
"Text4.Text = Clipboard.GetText
End Sub
-------------------------------------------------------------------
可以把需要複製文字的文字框定義成控制元件陣列
(將文字框控制元件的名稱設為相同,系統會提示是否建立控制元件陣列,選擇確定)
Private tempTxt As String
Private Sub Command1_Click()
For i = Text1.LBound To Text1.UBound
Text1(i).SetFocus
Text1(i).SelStart = 0
Text1(i).SelLength = Len(Text1(i).Text)
tempTxt = tempTxt + Text1(i).SelText
Next
End Sub
Private Sub Command2_Click()
Clipboard.Clear
Clipboard.SetText tempTxt
"Text4.SetFocus
"Text4.Text = Clipboard.GetText
End Sub