PDA

Click to See Complete Forum and Search --> : Reference textbox data from excel function


dencur
Jan 8th, 2006, 02:59 PM
I have created textbox1 on an excel spreadsheet and placed a number in it. I have written a function to get that number into an excel cell:

Public Function GetValue(Obj as Object)
Dim x as String

x = Obj.Value
GetValue = x
End Function


then in excel cell I call function:

=GetValue(TextBox1)

I can't get this work and feel I must be missing something pretty basic. It would be very valuable to be able to place data in textboxes, comboxes, etc. and then reference that data in excel functions for use use in excel formulas.
Regards, Dennis ;)

RobDog888
Jan 8th, 2006, 03:00 PM
Are you doing this only in Excels VBA or automating Excel from VB 6?

dencur
Jan 8th, 2006, 04:10 PM
I am doing this in excel vba - 1) Open excel and create textbox 2) Switch (Alt+F11) to VBA and write function 3)Switch back (Alt+F11) to excel sheet and try to use function. I can access contains via a Sub procedure and write to excel cell. The funtion would be much more powerful. Regards, dencur

Hack
Jan 9th, 2006, 06:31 AM
Moved to Office Development.