View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
neowok[_37_] neowok[_37_] is offline
external usenet poster
 
Posts: 1
Default selecting txt before a, or return character?

something strange is happening here, assigning a value to sstr as i
your example works fine, but as soon as i change it from assigning
value, to getting the value from the oval, i get the error i describe
above.

so code that works fine and goes and finds the 6515 value is:

Sub OvalClick()
Sheets("3.Data").Select
sStr = "6515" & vbNewLine & "6517"
iloc = InStr(sStr, vbNewLine)
sStr1 = Left(sStr, iloc - 1)
Worksheets("3.data").TextBox1.Text = sStr1
Sheet1.CommandButton2_Click
End Sub

but code that throws the above error when clicking on the oval whic
contains those values is:

Sub OvalClick()
Sheets("3.Data").Select
sStr = Worksheets("2.plan only").Shapes(Application.Caller). _
TextFrame.Characters.Text
iloc = InStr(sStr, vbNewLine)
sStr1 = Left(sStr, iloc - 1)
Worksheets("3.data").TextBox1.Text = sStr1
Sheet1.CommandButton2_Click
End Sub

which then throws "invalid procedure call or argument" on the sStr1
Left(sStr, iloc - 1) line.

hovwering the mouse over the items in that line when it throws th
error gives me sstr1 = empty, sstr = "6515[]6517" and iloc = 0

the [] in between the numbers is a little square box. interestingly i
i move the mouse over the "vbnewline" text just above this line, i
shows vbnewline = "[][]" i.e. TWO little square boxes rather than th
one which is between the text it grabbed out of the oval, perhaps thi
has something to do with it? it looks abit like vbnewline is
carriage returns and whats actually in the ovals is only one? if i pu
TWO returns in after the first number in the oval, then sstr does en
up with 2 [] in it so its 6515[][]6517, but still throws the same erro
so perhaps this isnt relevant after all?

any ideas

--
Message posted from http://www.ExcelForum.com