View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] david.anthony@amcor-flexibles.com is offline
external usenet poster
 
Posts: 2
Default 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!