Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a solution to this problem? The final space in a String is
deleted when assigned to a field in an Object variable. Dim obHead As Object Dim strLet As String strLet = "ABCD " 'ABCD and a final space obHead.Value("OBJ") = strLet "obHead.Value("OBJ") contains ABCD (no space) Thanks for any assistance! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use the trim function
either strLet = trim("ABCD ") 'ABCD and a final space or obHead.Value("OBJ") = trim(strLet) "obHead.Value("OBJ") contains ABCD "groupie" wrote: Is there a solution to this problem? The final space in a String is deleted when assigned to a field in an Object variable. Dim obHead As Object Dim strLet As String strLet = "ABCD " 'ABCD and a final space obHead.Value("OBJ") = strLet "obHead.Value("OBJ") contains ABCD (no space) Thanks for any assistance! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What object are you using?
What version of excel? You may get more people to test if you share that info. groupie wrote: Is there a solution to this problem? The final space in a String is deleted when assigned to a field in an Object variable. Dim obHead As Object Dim strLet As String strLet = "ABCD " 'ABCD and a final space obHead.Value("OBJ") = strLet "obHead.Value("OBJ") contains ABCD (no space) Thanks for any assistance! -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes,sorry should have been clearer.
I want to keep the final space from strLet in the object, notremoveit, however the assignment to the object removes it. Excel 2002 SP3 Seemsto happen to anything that is defined as an object. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can you share one of the objects you used to see the problem?
Might as well test on one that doesn't work for you. groupie wrote: Yes,sorry should have been clearer. I want to keep the final space from strLet in the object, notremoveit, however the assignment to the object removes it. Excel 2002 SP3 Seemsto happen to anything that is defined as an object. -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ps.
I tried it with a commandbutton from the Control toolbox toolbar and this returned 5: Option Explicit Sub testme() Dim myObj As Object Set myObj = ActiveSheet.CommandButton1 myObj.Caption = "qwer " MsgBox Len(myObj.Caption) End Sub groupie wrote: Yes,sorry should have been clearer. I want to keep the final space from strLet in the object, notremoveit, however the assignment to the object removes it. Excel 2002 SP3 Seemsto happen to anything that is defined as an object. -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ps (again):
I used a combobox from the control toolbox toolbar and this returned 5, too. Option Explicit Sub testme() Dim myObj As Object Set myObj = ActiveSheet.ComboBox1 myObj.Value = "qwer " MsgBox Len(myObj.Value) End Sub (This used .value) groupie wrote: Yes,sorry should have been clearer. I want to keep the final space from strLet in the object, notremoveit, however the assignment to the object removes it. Excel 2002 SP3 Seemsto happen to anything that is defined as an object. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I stop my tab from moving more than one space | Excel Discussion (Misc queries) | |||
Object Variable Not Set Error on Selection object | Excel Worksheet Functions | |||
Run-time Error'91: Object variable or With block variable not set | Excel Programming | |||
Run-time error '91': "Object variable or With block variable not set | Excel Programming | |||
Cells.Find error Object variable or With block variable not set | Excel Programming |