Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function problem 1

Status
Not open for further replies.

grommit1411

Programmer
Jan 30, 2005
2
GB
This code is in Form1 :-

Private Sub Command1_Click()
Call txtSend("Example 1", Form1)
End Sub

Private Sub Command2_Click()
Call txtSend("Example 2", Form1)
End Sub

This code is in Module1 :-

Function txtSend(TextToSend As String, f As Form)
With f
.Text1.LinkTopic = "Excel|Sheet1"
.Text1.LinkItem = "R1C1"
.Text1.LinkMode = 1
.Text1.Text = TextToSend
.Text1.LinkPoke
End With
End Function

how do i substitute Text1 like i have done with the form?

An empty excel workbook must be open for this to work.

grommit
 
Private Sub Command1_Click()
Call txtSend("Example 1", Form1.Text1)
End Sub

Private Sub Command2_Click()
Call txtSend("Example 2", Form1.Text1)
End Sub

Function txtSend(TextToSend As String, t as TextBox)
With t
.LinkTopic = "Excel|Sheet1"
.LinkItem = "R1C1"
.LinkMode = 1
.Text = TextToSend
.LinkPoke
End With
End Function

John Borges
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top