ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Retrieving Textbox values from another workbook (https://www.excelbanter.com/excel-programming/395885-retrieving-textbox-values-another-workbook.html)

[email protected]

Retrieving Textbox values from another workbook
 
Please help... I'm confused!

Basically I have a workbook which conatins a list of forms (other
Excel workbooks). I have set up code to open the chosen workbook. I
then have mountains of code within the individual workbooks which
select data and perform calculations, etc.

What i want to do is read in the values of a couple of the textboxes
and the manipulate them as strings (for constructing filenames, etc).
This all works fine at the moment, but I know need to get another bit
of code to do a similar thing, but rather than copy the code into the
individual workbooks, I was hoping I could somehow do it from the
original workbook with the list in it.

The code I have that works is this:

strTempNumber = Worksheets("Form").txtTempName.Value

There is a Textbox called txtTempName and I want to get the text in it
to go to the string strTempNumber.

If this code is saved in a module within the workbook it is acting on,
it works. I would like to find a way of getting this to work if the
code is saved somewhere else. Currently the code is activated by a
commandbutton on the spreadsheet itself where the textbox is...I want
to be able to activate the code from a button in the toolbar (which i
know how to set up), but I keep getting error 438.

I apologise if any of this is unclear...

What I really don't understand is why when i setup two blank
workbooks. I create a textbox in one of them. Then I write the code in
the other (provided I have the workbook with the textbox active), that
works. So I fail to see why this is different to my original
problem...

Thanks for any help in advance!



All times are GMT +1. The time now is 06:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com