从文本框中重新发送文本 [英] reteriving text from a text box

查看:55
本文介绍了从文本框中重新发送文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个程序,该文本从一个名为 data5  的文本框中取出文本,该文本框位于我已定义为工作簿的Excel文档中( fileName )。工作表(1)。我想取这个 字符串并保存为
lastTextbox   并将它放在另一个名为$ b的excel文档中单元格(i,3)上的$ b Clients1 无论我尝试什么,我都无法通过vb程序查看和读取文本框数据中的数据.5。
  

b $ b顺便说一句,所有内容都在不同的工作簿中.b
 

我已经尝试了一切我能想到的天气这是.range方法或者是
focus()。但是在实际文本中将文本框形式放在另一个文档中总是存在问题。有人可以帮助我

Im trying to write a progam that takes text out of a text box named data5 that is in a excel document that which I have defined as workbooks(fileName).worksheet(1).I want to take that string and save is a lastTextbox  and put it in a another excel document that is called Clients1 at cell(i,3). no matter what I try I cant get the vb progam to see and read that data in textbox data5.
  

btw everything is in different workbooks
 
I have tried everything I can think of weather it is the .range method or
focus(). but there is always a problem getting the actual text form the text box in a different document. can someone plz help me

  Do while fileName<> ""&bbsp;            i = i + 1

            j = 2

            jj = j + 1

           单元格(i,1)= fileName

           单元格(i,2)= lastTextbox为
            Application.ScreenUpdating = False

            Workbooks.Open(目录和文件名)

         "&NBSP;&NBSP;工作簿(目录和文件名).Worksheets(1).data5.Focus()

            firstChr = data5.selectionStart = 0

            lastTextbox = data5.SelectionLength = data5.Text.Length

           

            Workbooks.Open(目录&"clients1.xlsx")

           对于工作簿中的每个工作表(fileName).Worksheets

 Do While fileName <> ""
            i = i + 1
            j = 2
            jj = j + 1
            Cells(i, 1) = fileName
            Cells(i, 2) = lastTextbox
            Application.ScreenUpdating = False
            Workbooks.Open (directory & fileName)
         '   Workbooks(directory & fileName).Worksheets(1).data5.Focus()
            firstChr = data5.selectionStart = 0
            lastTextbox = data5.SelectionLength = data5.Text.Length
           
            Workbooks.Open (directory & "clients1.xlsx")
            For Each sheet In Workbooks(fileName).Worksheets

推荐答案

您希望此声明做什么?

What do you expect this statement to do?

lastTextbox = data5.SelectionLength = data5.Text.Length

不太可能达到预期目的。

It is unlikely to do what you expect.

此论坛支持Visual Studio中的Visual Basic(VB 7及更高版本)。您似乎在Excel中使用Visual Basic for Applications(VBA)。

This forum supports Visual Basic in Visual Studio (VB 7 and later). You seem to be using Visual Basic for Applications (VBA) in Excel.

有关VBA语言的帮助,请尝试
VBA论坛

For help with the VBA language, try the VBA Forum

要获得在Excel中使用VBA的帮助,请尝试< a href ="https://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc">
Excel for Developers Forum

For help using VBA in Excel, try the Excel for Developers Forum


这篇关于从文本框中重新发送文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆