|
Prev: create exe file
Next: Copy and Paste Problem
From: Bob C on 19 Jul 2008 00:44 The code below ran in Windows Excel 2003 but stops in 2007 at the line starting with; Selection.Characters.Text = "Click to Run" & Chr(10) & "all macro's automatically." Could anyone point me as to why? I have recorded the operation in 2007 and the line records the same as 2003. Dim dWidth As Double Dim dHeight As Double Dim dTop As Double Dim dLeft As Double [B2].Activate With ActiveCell dTop = .Top dLeft = .Left dHeight = .Height dWidth = .Width End With ActiveSheet.Buttons.Add(dLeft, dTop, dWidth, dHeight).Select Selection.OnAction = "Bttn1_RunAll" Selection.Placement = xlFreeFloating Selection.Width = 236.5 Selection.Height = 50.5 Selection.ShapeRange.IncrementTop 0.75 Selection.Characters.Text = "Click to Run" & Chr(10) & "all macro's automatically." With Selection.Characters(Start:=1, Length:=39).Font .Name = "Arial" .FontStyle = "Bold Italic" .Size = 12 .ColorIndex = 13 End With With Selection.Characters(Start:=1, Length:=12) .Font.Size = 24 End With -- Thank you Aussie Bob C It cost''s little to carry knowledge with you.
From: Nigel on 19 Jul 2008 01:15 It appears that the Chr(10) is the issue here, try using Selection.Characters.Text = "Click to Run" & vbCrLf & _ "all macro's automatically." -- Regards, Nigel nigelnospam(a)9sw.co.uk "Bob C" <BobC(a)discussions.microsoft.com> wrote in message news:74B1CA98-65B9-4B10-9D03-17BF09B7790F(a)microsoft.com... > The code below ran in Windows Excel 2003 but stops in 2007 at the line > starting with; > Selection.Characters.Text = "Click to Run" & Chr(10) & "all macro's > automatically." > Could anyone point me as to why? > I have recorded the operation in 2007 and the line records the same as > 2003. > > Dim dWidth As Double > Dim dHeight As Double > Dim dTop As Double > Dim dLeft As Double > > [B2].Activate > With ActiveCell > dTop = .Top > dLeft = .Left > dHeight = .Height > dWidth = .Width > End With > > ActiveSheet.Buttons.Add(dLeft, dTop, dWidth, dHeight).Select > Selection.OnAction = "Bttn1_RunAll" > Selection.Placement = xlFreeFloating > Selection.Width = 236.5 > Selection.Height = 50.5 > Selection.ShapeRange.IncrementTop 0.75 > Selection.Characters.Text = "Click to Run" & Chr(10) & "all macro's > automatically." > With Selection.Characters(Start:=1, Length:=39).Font > .Name = "Arial" > .FontStyle = "Bold Italic" > .Size = 12 > .ColorIndex = 13 > End With > With Selection.Characters(Start:=1, Length:=12) > .Font.Size = 24 > End With > > -- > Thank you > > Aussie Bob C > It cost''s little to carry knowledge with you. >
From: Bob C on 19 Jul 2008 02:11 Hi Nigel It stopped on the same line with the following error message; 'Run Time Error '1004' 'Unable to set text property of the characters class' Thank you Bob C It cost''s little to carry knowledge with you. "Nigel" wrote: > It appears that the Chr(10) is the issue here, try using > > Selection.Characters.Text = "Click to Run" & vbCrLf & _ > "all macro's automatically." > > > -- > > Regards, > Nigel > nigelnospam(a)9sw.co.uk > > > > "Bob C" <BobC(a)discussions.microsoft.com> wrote in message > news:74B1CA98-65B9-4B10-9D03-17BF09B7790F(a)microsoft.com... > > The code below ran in Windows Excel 2003 but stops in 2007 at the line > > starting with; > > Selection.Characters.Text = "Click to Run" & Chr(10) & "all macro's > > automatically." > > Could anyone point me as to why? > > I have recorded the operation in 2007 and the line records the same as > > 2003. > > > > Dim dWidth As Double > > Dim dHeight As Double > > Dim dTop As Double > > Dim dLeft As Double > > > > [B2].Activate > > With ActiveCell > > dTop = .Top > > dLeft = .Left > > dHeight = .Height > > dWidth = .Width > > End With > > > > ActiveSheet.Buttons.Add(dLeft, dTop, dWidth, dHeight).Select > > Selection.OnAction = "Bttn1_RunAll" > > Selection.Placement = xlFreeFloating > > Selection.Width = 236.5 > > Selection.Height = 50.5 > > Selection.ShapeRange.IncrementTop 0.75 > > Selection.Characters.Text = "Click to Run" & Chr(10) & "all macro's > > automatically." > > With Selection.Characters(Start:=1, Length:=39).Font > > .Name = "Arial" > > .FontStyle = "Bold Italic" > > .Size = 12 > > .ColorIndex = 13 > > End With > > With Selection.Characters(Start:=1, Length:=12) > > .Font.Size = 24 > > End With > > > > -- > > Thank you > > > > Aussie Bob C > > It cost''s little to carry knowledge with you. > > >
From: Jarek Kujawa on 19 Jul 2008 05:10 I copied the row to my PC and it reads Selection.Characters.Text = "Click to Run" & Chr(10) & "all macro's " automatically." delete the rightmost " sign in the 1st row and adjust all to look like this: Selection.Characters.Text = "Click to Run" & Chr(10) & "all macro's automatically." it works on my Excel 2007
From: Jarek Kujawa on 19 Jul 2008 05:45
the browser wraps it incorrectly should be: Selection.Characters.Text = "Click to Run" & Chr(10) & "all macro's _ automatically." |