Help Please: Frustrated novice need help with simple proceedure 
Author Message
 Help Please: Frustrated novice need help with simple proceedure

I know I'm not the greatest VB programmer but I do know some things.

I am wondering how to get a textbox to work in Excel97. I have tried
everything I know even the simple cmdButton click procedure(see next
paragraph). That works but I want it to read a value fron another
sheet, which I have identified and put the cell values as (eg) r3c5
and it just won't work for me.

I just us a standard click procedure and set my text value in the code
(because I can't get it to read a cell value yet!). I protect the
sheet to see if all is working. Once the button works and I unprotect
the sheet to look at the code and I can't get any thing from right
clicking on it! Is there a reason for this?

I have talked with others who said that writing real VB code, not VBA
(I'm not clear on the difference) doesn't always work in Excel. Is
there any truth to that or just a good excuse for me to explain why I
can't get anything to work.

Thanks in advance. Please post answer here...others novices amy need
to lean also.




Sun, 02 Mar 2003 11:05:35 GMT  
 Help Please: Frustrated novice need help with simple proceedure

Try playin with this....
I have one textbox and one command button with default names on a sheet.

Private Sub CommandButton1_Click()
Dim strTextToPost As String    'Dim  variable to build a text string with

TextBox1.Text = ""                    'Clear the text box

strTextToPost = ActiveSheet.Range("B1")                                'Add
value in B1 to variable
strTextToPost = strTextToPost & ActiveSheet.Range("C1")    'Add value in C1
to variable

TextBox1.Text = strTextToPost    'Set the textbox.text = to variable
End Sub

Quote:

>I know I'm not the greatest VB programmer but I do know some things.

>I am wondering how to get a textbox to work in Excel97. I have tried
>everything I know even the simple cmdButton click procedure(see next
>paragraph). That works but I want it to read a value fron another
>sheet, which I have identified and put the cell values as (eg) r3c5
>and it just won't work for me.

>I just us a standard click procedure and set my text value in the code
>(because I can't get it to read a cell value yet!). I protect the
>sheet to see if all is working. Once the button works and I unprotect
>the sheet to look at the code and I can't get any thing from right
>clicking on it! Is there a reason for this?

The click event does not pass a Button variable to the event.  Use the
CommandButton1_MouseDown event to determine a right from a left click.

Private Sub CommandButton1_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)

Select Case Button

    Case Is = 1 'Left Button

    Case Is = 2 'Right Button

    Case Is = 4 'Middle button

End Select
End Sub

Quote:

>I have talked with others who said that writing real VB code, not VBA
>(I'm not clear on the difference) doesn't always work in Excel. Is
>there any truth to that or just a good excuse for me to explain why I
>can't get anything to work.

There is some truth to it. VB has objects available to it that VBA does not.
Quote:

>Thanks in advance. Please post answer here...others novices amy need
>to lean also.





Sun, 02 Mar 2003 13:56:16 GMT  
 Help Please: Frustrated novice need help with simple proceedure
I'm going to give this a shot even though I don't fully understand
everything thats going on myself.  I do hope others will chime in if
(likely) I make a mistake here.

My first comment is that as of Visual Basic Version 5, the VB and VBA
languages are one and the same.  Not just similar, but precisely the
*same*.  Every visual basic program references the same "Visual Basic
for Applications" library that an Excel (or Word or PowerPoint) project
does.  There is in fact only the "Visual Basic for Applications"
language that is used across all MS applications as well as some other
3rd party applications as well as the Visual Basic compiler itself.
This is the good news.

The bad news is that the objects you control using this language (such
as textboxes) come in (too) many different flavors and revisions.

   *What* textbox ?

Microsoft throws at least 3 (maybe more?) similar yet maddeningly
different textboxes at us.

There is the VB textbox object wrapped up in the Visual Basic runtime
library.  This is probably what you are used to but it is
*inaccessable* to Excel, even though you might have the Visual Basic
compiler installed on your machine.  Did you mean to paste this on an
Excel spreadsheet?  If so just forget it.  There are (2) other
textboxes that you can use, however.  Just know that they will not work
*exactly* the same as the Visual Basic compilers' textbox.

There is the "TextBox" that has been available in many past revisions
of Excel and is still available in Excel 2000.  This is the one you
typically draw on a worksheet using the "Drawing" toolbar.  This gizmo
is really handy and reliable.  Even though it doesn't respond to
events :-( you can give it a logical name and control it through code.
You can also directly enter a cell reference on the formula bar and the
text in the textbox will automatically reflect the contents of that
cell.  The referenced cell can be on the same sheet the textbox is on
OR it can be on another sheet.  Just set the formula "=Sheet3!B4".  You
can also just set .Text = "whatever" or .text = worksheets
("Sheet3").range("B4").value from code.  I still use this in Excel 2000
even though MS is trying to discourage it.  Why I still use it is
explained below.

The third "textbox" object is the one that comes from the MSForms
library that is always loaded into an Excel (or Word or PPT) project.
You typically put this on a spreadsheet by drawing it from the Control
toolbox.  This gizmo is very similar (maddeningly different?) from the
VB compler textbox.  MS wants you to use this.  It responds to events :-
)  Seems to work great when used on a UserForm but has, in the past,
*bombed* horribly when pasted on a spreadsheet.  This *might* be fixed
in Excel 2000 but I am still gunshy and want to hear someone else tell
me it's "fixed" before I waste anymore time with it.  It also permits
you to directly set a worksheet cell range in its "LinkedCell"
property.  You can also just .text = "whatever" from code.

Ok - did I clarify or confuse?  VB - VBA language the same.  Textboxes
and other objects - different :-(   Why, oh why! can't Microsoft put
out a single TextBox.ocx that you can reference throughout VB and the
MS office system?  I could use some clarification myself.

-Graphman



Quote:
> I know I'm not the greatest VB programmer but I do know some things.

> I am wondering how to get a textbox to work in Excel97. I have tried
> everything I know even the simple cmdButton click procedure(see next
> paragraph). That works but I want it to read a value fron another
> sheet, which I have identified and put the cell values as (eg) r3c5
> and it just won't work for me.

> I just us a standard click procedure and set my text value in the code
> (because I can't get it to read a cell value yet!). I protect the
> sheet to see if all is working. Once the button works and I unprotect
> the sheet to look at the code and I can't get any thing from right
> clicking on it! Is there a reason for this?

> I have talked with others who said that writing real VB code, not VBA
> (I'm not clear on the difference) doesn't always work in Excel. Is
> there any truth to that or just a good excuse for me to explain why I
> can't get anything to work.

> Thanks in advance. Please post answer here...others novices amy need
> to lean also.



Sent via Deja.com http://www.deja.com/
Before you buy.


Sun, 02 Mar 2003 22:14:43 GMT  
 Help Please: Frustrated novice need help with simple proceedure
Graphman:

You clarified! I was using the textbox from the VB tools in Excel. Now
I am lead to try the other methods. Yes, Microsoft does make it hard.

Does hair grow back?

Thanks for your help,

baz



Quote:
>I'm going to give this a shot even though I don't fully understand
>everything thats going on myself.  I do hope others will chime in if
>(likely) I make a mistake here.

>My first comment is that as of Visual Basic Version 5, the VB and VBA
>languages are one and the same.  Not just similar, but precisely the
>*same*.  Every visual basic program references the same "Visual Basic
>for Applications" library that an Excel (or Word or PowerPoint) project
>does.  There is in fact only the "Visual Basic for Applications"
>language that is used across all MS applications as well as some other
>3rd party applications as well as the Visual Basic compiler itself.
>This is the good news.

>The bad news is that the objects you control using this language (such
>as textboxes) come in (too) many different flavors and revisions.

>   *What* textbox ?

>Microsoft throws at least 3 (maybe more?) similar yet maddeningly
>different textboxes at us.

>There is the VB textbox object wrapped up in the Visual Basic runtime
>library.  This is probably what you are used to but it is
>*inaccessable* to Excel, even though you might have the Visual Basic
>compiler installed on your machine.  Did you mean to paste this on an
>Excel spreadsheet?  If so just forget it.  There are (2) other
>textboxes that you can use, however.  Just know that they will not work
>*exactly* the same as the Visual Basic compilers' textbox.

>There is the "TextBox" that has been available in many past revisions
>of Excel and is still available in Excel 2000.  This is the one you
>typically draw on a worksheet using the "Drawing" toolbar.  This gizmo
>is really handy and reliable.  Even though it doesn't respond to
>events :-( you can give it a logical name and control it through code.
>You can also directly enter a cell reference on the formula bar and the
>text in the textbox will automatically reflect the contents of that
>cell.  The referenced cell can be on the same sheet the textbox is on
>OR it can be on another sheet.  Just set the formula "=Sheet3!B4".  You
>can also just set .Text = "whatever" or .text = worksheets
>("Sheet3").range("B4").value from code.  I still use this in Excel 2000
>even though MS is trying to discourage it.  Why I still use it is
>explained below.

>The third "textbox" object is the one that comes from the MSForms
>library that is always loaded into an Excel (or Word or PPT) project.
>You typically put this on a spreadsheet by drawing it from the Control
>toolbox.  This gizmo is very similar (maddeningly different?) from the
>VB compler textbox.  MS wants you to use this.  It responds to events :-
>)  Seems to work great when used on a UserForm but has, in the past,
>*bombed* horribly when pasted on a spreadsheet.  This *might* be fixed
>in Excel 2000 but I am still gunshy and want to hear someone else tell
>me it's "fixed" before I waste anymore time with it.  It also permits
>you to directly set a worksheet cell range in its "LinkedCell"
>property.  You can also just .text = "whatever" from code.

>Ok - did I clarify or confuse?  VB - VBA language the same.  Textboxes
>and other objects - different :-(   Why, oh why! can't Microsoft put
>out a single TextBox.ocx that you can reference throughout VB and the
>MS office system?  I could use some clarification myself.

>-Graphman



>> I know I'm not the greatest VB programmer but I do know some things.

>> I am wondering how to get a textbox to work in Excel97. I have tried
>> everything I know even the simple cmdButton click procedure(see next
>> paragraph). That works but I want it to read a value fron another
>> sheet, which I have identified and put the cell values as (eg) r3c5
>> and it just won't work for me.

>> I just us a standard click procedure and set my text value in the code
>> (because I can't get it to read a cell value yet!). I protect the
>> sheet to see if all is working. Once the button works and I unprotect
>> the sheet to look at the code and I can't get any thing from right
>> clicking on it! Is there a reason for this?

>> I have talked with others who said that writing real VB code, not VBA
>> (I'm not clear on the difference) doesn't always work in Excel. Is
>> there any truth to that or just a good excuse for me to explain why I
>> can't get anything to work.

>> Thanks in advance. Please post answer here...others novices amy need
>> to lean also.


>Sent via Deja.com http://www.deja.com/
>Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 Help Please: Frustrated novice need help with simple proceedure
TAC:

Thanks. I will give it a try. I am open to all options and anyway I
always learn from trying times like this!

Thanks again,

baz



Quote:

>Try playin with this....
>I have one textbox and one command button with default names on a sheet.

>Private Sub CommandButton1_Click()
>Dim strTextToPost As String    'Dim  variable to build a text string with

>TextBox1.Text = ""                    'Clear the text box

>strTextToPost = ActiveSheet.Range("B1")                                'Add
>value in B1 to variable
>strTextToPost = strTextToPost & ActiveSheet.Range("C1")    'Add value in C1
>to variable

>TextBox1.Text = strTextToPost    'Set the textbox.text = to variable
>End Sub


>>I know I'm not the greatest VB programmer but I do know some things.

>>I am wondering how to get a textbox to work in Excel97. I have tried
>>everything I know even the simple cmdButton click procedure(see next
>>paragraph). That works but I want it to read a value fron another
>>sheet, which I have identified and put the cell values as (eg) r3c5
>>and it just won't work for me.

>>I just us a standard click procedure and set my text value in the code
>>(because I can't get it to read a cell value yet!). I protect the
>>sheet to see if all is working. Once the button works and I unprotect
>>the sheet to look at the code and I can't get any thing from right
>>clicking on it! Is there a reason for this?

>The click event does not pass a Button variable to the event.  Use the
>CommandButton1_MouseDown event to determine a right from a left click.

>Private Sub CommandButton1_MouseDown(ByVal Button As Integer, ByVal Shift As
>Integer, ByVal X As Single, ByVal Y As Single)

>Select Case Button

>    Case Is = 1 'Left Button

>    Case Is = 2 'Right Button

>    Case Is = 4 'Middle button

>End Select
>End Sub

>>I have talked with others who said that writing real VB code, not VBA
>>(I'm not clear on the difference) doesn't always work in Excel. Is
>>there any truth to that or just a good excuse for me to explain why I
>>can't get anything to work.

>There is some truth to it. VB has objects available to it that VBA does not.

>>Thanks in advance. Please post answer here...others novices amy need
>>to lean also.





Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

2. Need help on simple VB database : novice

3. Urgent help needed by novice, please!

4. Urgent help needed by novice, please!

5. help, help, help...I'm begging here :-\ RE RE POST simple code help needed

6. need help with program calling proceedure

7. need help with program calling proceedure.

8. Simple help needed please....

9. Need help on simple SQL query please!

10. Frustrated with cell references-please help!

11. Frustrated newbie - please help

12. Help Please (a frustrated persons plea)

 

 
Powered by phpBB® Forum Software