Resize of comments box / shape etc

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,738
Office Version
  1. 2007
Platform
  1. Windows
Hi,
Please can you advise on my code as i have an issue i am unable to sort.

The shape is to small for the amount of text within it,ive tried to add like .Autoresize = False etc but just got errors.
Shape needs to expand to allow all the text to be read.



Rich (BB code):
 For Each MyComments In ActiveSheet.Comments
            With MyComments
                .Shape.AutoShapeType = msoShapeRoundedRectangle
                .Shape.TextFrame.Characters.Font.Name = "Times Roman" 'FONT STYLE CORRECT
                .Shape.TextFrame.Characters.Font.Size = 20  'TEXT SIZE CORRECT
                .Shape.TextFrame.Characters.Font.ColorIndex = 1 'TEXT COLOR CORRECT
                .Shape.LINE.ForeColor.RGB = RGB(255, 0, 255)
                .Shape.LINE.BackColor.RGB = RGB(255, 255, 255)
                .Shape.Fill.Visible = msoTrue
                .Shape.Fill.ForeColor.RGB = RGB(0, 255, 255) ' FILL COLOR CORRECT
                .Shape.Fill.OneColorGradient msoGradientDiagonalUp, 1, 0.23
           End With
          Next 'comment
 

Attachments

  • 471.jpg
    471.jpg
    37.9 KB · Views: 27
Does changing this
VBA Code:
    If TextBox6.Value = "" Then
         .Cells(lastrow + 1, 4).Value = "NOTE"
         With ActiveSheet.Range("D" & lastrow + 1).Comment.Shape
For Each MyComments In ActiveSheet.Comments
    With MyComments
        .Shape.AutoShapeType = msoShapeRoundedRectangle
        .Shape.TextFrame.Characters.Font.Name = "Times Roman"
        .Shape.TextFrame.Characters.Font.Size = 20
        .Shape.TextFrame.Characters.Font.ColorIndex = 1
        .Shape.LINE.ForeColor.RGB = RGB(255, 0, 255)
        .Shape.LINE.BackColor.RGB = RGB(255, 255, 255)
        .Shape.Fill.Visible = msoTrue
        .Shape.Fill.ForeColor.RGB = RGB(0, 255, 255)
        .Shape.Fill.OneColorGradient msoGradientDiagonalUp, 1, 0.23
        .Shape.TextFrame.AutoSize = True
    End With
Next    'comment
    Else
         .Cells(lastrow + 1, 4).Value = TextBox6.Text
    End If

to this help any? The "Nothing here" is so I can see something in the comment.
VBA Code:
    If TextBox6.Value = "" Then
         .Cells(lastrow + 1, 4).Value = "NOTE"
            Set MyComments = ActiveSheet.Range("D" & lastrow + 1).AddComment("Nothing here")
            With MyComments
                .Shape.AutoShapeType = msoShapeRoundedRectangle
                .Shape.TextFrame.Characters.Font.Name = "Times Roman"
                .Shape.TextFrame.Characters.Font.Size = 20
                .Shape.TextFrame.Characters.Font.ColorIndex = 1
                .Shape.LINE.ForeColor.RGB = RGB(255, 0, 255)
                .Shape.LINE.BackColor.RGB = RGB(255, 255, 255)
                .Shape.Fill.Visible = msoTrue
                .Shape.Fill.ForeColor.RGB = RGB(0, 255, 255)
                .Shape.Fill.OneColorGradient msoGradientDiagonalUp, 1, 0.23
                .Shape.TextFrame.AutoSize = True
            End With
    Else
         .Cells(lastrow + 1, 4).Value = TextBox6.Text
    End If
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hi,

See screenshots for outcome

To see something in the comment do this.

Click blue open form
 

Attachments

  • 484.jpg
    484.jpg
    20.8 KB · Views: 7
  • 485.jpg
    485.jpg
    118.6 KB · Views: 8
  • 486.jpg
    486.jpg
    198.3 KB · Views: 9
Upvote 0
Sorry buddy, I don't know how to fix something when it works for me, I don't get any error.
I downloaded your file again in case I had inadvertently changed something else and replaced the code as per post 11 and it works straight away.

my results.jpg
 
Upvote 0
Thanks.
Very strange
Can you send back the file shown which works for you and let me then add a comment and see what happens.
 
Upvote 0
Morning,
Ive tried to open the file that was just downloaded but takes ages to open.
Once open i click on the command button to open the form but see the following error.

Is the file you uploaded the one you had used as strange this has appeared if it was ok for you
 

Attachments

  • 487.jpg
    487.jpg
    76.2 KB · Views: 7
Upvote 0
Morning ???
it's around 1:30 am here, can't sleep tonight.

Don't know what to tell you, it works fine for me.
I did notice the file you uploaded was 3.3meg and my Excel 2010 saved it at 1.6meg.
Sorry but I'm afraid that's all the help I can offer with this.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top