View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JLatham JLatham is offline
external usenet poster
 
Posts: 2,203
Default selection.text erro 1004

One of the big changes in 2007 was the whole family of shapes and the
graphics engine in general.

To run in both 2007 and earlier versions, you'll need to test for the
version of Excel that the file is running on and switch tracks accordingly.

If Range_maxmej = True Then
logicsheetmej.Shapes(xyz).GroupItems(12).Select
If Val(Application.Version)=12 then
'Excel 2007 or later
Selection.Text = Importsheetmej.Cells(imej, 11)
Else
'pre 2007 version of Excel
Selection.Characters.Text = ImportSheetmej.Cells(imej,11)
End If
End If

I haven't tested this and you may have to include the selection of the shape
within the IF..Then...Else block as I'm not sure how Excel 2003 will deal
with the .GroupItems(12). parameter.
"perf" wrote:

Hi all,
I am experiencing a problem that is drving me crazy...

I have this portion of code in excel 2007, where I decide to change the text
of the 12th element of a group of shapes (line and text box)

If Range_maxmej = True Then
logicsheetmej.Shapes(xyz).GroupItems(12).Select
Selection.Text = Importsheetmej.Cells(imej, 11)
End If

logicsheetmej and Importsheetmej are defined as sheets.

this code in office 2007 works perfectly, absolutely no problem

Now, i have also to make possible to use it in excel 2003. and it does not
work anymo Selection.Text = Importsheetmej.Cells(imej, 11) gives me a
1004 error "unable to set the text property"

why is this happening?

thanks in advance

marco