PDA

View Full Version : unable to set the text property of the characters class



Pkumar
03-31-2010, 10:45 AM
Hi,

I have created a tool in excel 2003(VBA). when am saving the tool in 2007 (.xlsm) format, some user get "run time error 1004" "unable to set the text property of the characters class" but for some its working fine.

Can anyone tell me what the issue here is ??

Thanks and Regards
Pramod Kumar

Bob Phillips
03-31-2010, 11:03 AM
Not without seeing the code at least.

Pkumar
03-31-2010, 11:29 PM
Hi Xld,

Unfortunately i cannot attach the tool as it has company proprietary information (apologies for that).

The issue here is that the tool functions properly in any of the system in my company but when we send the tool to our clients , some of them get the above mentioned error .

The only external component iam using in the tool is "Microsoft forms 2.0 object library" to create button based on certain conditions.


Public Sub Add_Summary_Button()
ActiveSheet.Buttons.Add(199.5, 10, 81, 36).Select
Selection.ShapeRange.IncrementLeft 514#
Selection.ShapeRange.IncrementTop 2.25
Selection.Name = "View_Results"
ActiveSheet.Shapes("View_Results").Select
Selection.Characters.Text = "View Results"
ActiveSheet.Shapes("View_Results").Select
Selection.OnAction = "Summary_Sheet"
End Sub

Could this be an issue?? is there an alternate way of using activeXcontrol rather than shapes?

Thanks and regards
Pramod Kumar

Bob Phillips
04-01-2010, 12:54 AM
Are all your machines 2003 and some of your clients have 2007?

Pkumar
04-01-2010, 01:12 AM
We have both in our company 2003 and 2007...i tried in both versions (.xls and .xlsm) in here its working fine .Yes our clients have 2007 version and i have given them a document to convert 2003 into 2007(.xlsm) version . They did that successfully just that the tool shows above mentioned error just on their system.

Bob Phillips
04-01-2010, 01:46 AM
That makes it very difficult, I have just tried that code and it worked as expected.

You can rationalise the code



With ActiveSheet.Buttons.Add(199.5, 10, 81, 36)

.ShapeRange.IncrementLeft 514#
.ShapeRange.IncrementTop 2.25
.Name = "View_Results"
.Characters.Text = "View Results"
.OnAction = "Summary_Sheet"
End With


but I cannot see that solving the problem

Pkumar
04-01-2010, 02:06 AM
so did u try it in 2007 or 2003?

Bob Phillips
04-01-2010, 02:13 AM
Excel 2007. Just tried it in 2003 as well, as expected no problems there.

Pkumar
04-01-2010, 02:36 AM
i guess then..i will have to start from scratch and do a more refined RCA..thanks for your help Bob i will let you know if i get any solution.

Pkumar
04-01-2010, 03:59 AM
Ok i got a start here . Attached please find the error line, when the client hits debug on the run time error window box , it shows the error line as "Selection.characters.text = "Input Response for next Function"

why is it running fine on my system and not on client system??

Thanks and Regards
Pramod Kumar

Bob Phillips
04-01-2010, 04:23 AM
Pramod,

Give my amended code a try, it just might be a selection issue.

Pkumar
04-01-2010, 05:55 AM
I gave it try still dosent work :banghead:....BAD DAy for me

Pkumar
04-01-2010, 06:09 AM
:clap: ok the tool is working now when i reduce the character length from

"Selection.characters.text = "Input Response for next Function"

to

"Selection.characters.text = "Next Function"

Its working fine ....but the mystery is why was it working on our company system.

Pkumar
04-01-2010, 06:10 AM
is there some length limitation

Bob Phillips
04-01-2010, 06:34 AM
Can't be, not at that value, because it works for you and for me.