Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word 2010 macro lack of recording mouse movements

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
I used keyboard to create a red elipse or so I thought. Sicen 2010 does not record mouse mouse anymore?????? this is all the code there is and I can't seem to understand it. nothing is missing it made this mess.
all I want is a red elipse on the document with no back fill.

Code:
Sub ImageAddFrame_TextWrapTB()
'
' ImageAddFrame_TextWrapTB Macro

    Dim Shp As Shape
    
    With Selection
    
        If .InlineShapes.Count = 1 Then
          Set Shp = .InlineShapes(1).ConvertToShape
        Else
          Set Shp = .ShapeRange(1)
        End If
        
        With Shp
          With .WrapFormat
            .Type = wdWrapTopBottom
            .DistanceTop = InchesToPoints(0.1)
            .DistanceBottom = InchesToPoints(0.1)
          End With
            With .Line
              .Weight = 2#
              .ForeColor.RGB = RGB(0, 0, 0)
            End With
            
      End With
End With

'
End Sub

 Imp Case Is <= Option Private Module ' <<< what is this it added to teh bottom of the  Module
'
' RedElipse Macro
'
'
    Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub

DougP
 
I after doing some digging I found this... so
whatever version of Word (2002 or 2003) I was using back in Jan 2011 created this, which also works fine once pasted in 2010. BUT 2010 will not record anything anymore.

Code:
Sub RedElipse()

'
' RedElipse Macro
' Macro recorded 1/13/2011 by dposton
' this creates and autoshape of a red elipese with  no fill color
    ActiveDocument.Shapes.AddShape(msoShapeOval, 198#, 153#, 54#, 27#) _
        .Select
    Selection.ShapeRange.Fill.Visible = msoFalse
    Selection.ShapeRange.Fill.Solid
    Selection.ShapeRange.Fill.Transparency = 1
    Selection.ShapeRange.Line.Weight = 1#
    Selection.ShapeRange.Line.DashStyle = msoLineSolid
    Selection.ShapeRange.Line.Style = msoLineSingle
    Selection.ShapeRange.Line.Transparency = 0#
    Selection.ShapeRange.Line.Visible = msoTrue
    Selection.ShapeRange.Line.ForeColor.RGB = RGB(255, 0, 0)
    Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.LockAspectRatio = msoFalse
    Selection.ShapeRange.Rotation = 0#
    Selection.ShapeRange.Left = 198#
    Selection.ShapeRange.Top = 153.35
    Selection.ShapeRange.RelativeHorizontalPosition = _
        wdRelativeHorizontalPositionColumn
    Selection.ShapeRange.RelativeVerticalPosition = _
        wdRelativeVerticalPositionParagraph

    Selection.ShapeRange.LockAnchor = False
    Selection.ShapeRange.LayoutInCell = True
    Selection.ShapeRange.WrapFormat.AllowOverlap = True
    Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
    Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
    Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
    Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
    Selection.ShapeRange.WrapFormat.DistanceRight = InchesToPoints(0.13)
    Selection.ShapeRange.WrapFormat.Type = 3
    Selection.ShapeRange.ZOrder 4
    
End Sub

DougP
 
Doug, Doug, Doug...

Code:
'.....
End Sub
'[b][red][highlight]SOMETHING IS MISSING HERE or you have an extraneous End Sub????[/highlight][/red][/b]
 Imp Case Is <= Option Private Module ' <<< what is this it added to teh bottom of the  Module
'
' RedElipse Macro
'
'
    Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
You cannot record a macro and have TWO End Sub statements!

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Did you mean [highlight]this[/highlight]???

Code:
Sub ImageAddFrame_TextWrapTB()
'
' ImageAddFrame_TextWrapTB Macro

    Dim Shp As Shape
    
    With Selection
    
        If .InlineShapes.Count = 1 Then
          Set Shp = .InlineShapes(1).ConvertToShape
        Else
          Set Shp = .ShapeRange(1)
        End If
        
        With Shp
          With .WrapFormat
            .Type = wdWrapTopBottom
            .DistanceTop = InchesToPoints(0.1)
            .DistanceBottom = InchesToPoints(0.1)
          End With
            With .Line
              .Weight = 2#
              .ForeColor.RGB = RGB(0, 0, 0)
            End With
            
      End With
End With

'
End Sub
'[highlight][b]from this point to the bottom was added when I recorded my macro[/b]
 Imp Case Is <= Option Private Module ' <<< what is this it added to teh bottom of the  Module
'
' RedElipse Macro
'
'
    Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub
'[/highlight]

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
As I pointed out in the original thread, this is because Word 2010 can no longer record Shape macros. Microsoft seem to try and claim that this is "by design". A workaround is to save the document as a DOC (rather than DOCX or DOCM) and then record the macro, which will now magically work fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top