PC Review


Reply
Thread Tools Rate Thread

changing activesheet shapes label caption

 
 
baha17@gmail.com
Guest
Posts: n/a
 
      30th Aug 2011
Hi All,
I have following code but it doess not work.Basically I try to change
the captions in a loop.Any help?
Thank you very much in advance
baha
sub givingnames
Dim i As Variant
Dim a As Variant
a = Sheet4.Range("AT39").Value

For i = 1 To 10
On Error Resume Next
ActiveSheet.Shapes("Image" & i).OLEFormat.Object.Object.Picture = _
LoadPicture(ThisWorkbook.Path & "\Pictures\" & a & ".BMP")
ActiveSheet.Shapes("LabelA" & i).Caption =
Application.WorksheetFunction.VLookup((a),
Sheets("DataPage").Range("dataA"), 2, 0) ' & _
'vbCrLf & "TempCard: " & Application.WorksheetFunction.VLookup(i + k +
alt - 1, Sheets("DataPage").Range("dataA"), 4, 0)

a = a + 1
If Dir(ThisWorkbook.Path & "\Pictures\" & i & ".BMP") = "" Then
ActiveSheet.Shapes("Image" & i).OLEFormat.Object.Object.Picture = _
LoadPicture(ThisWorkbook.Path & "\Pictures\nopic.BMP")
End If
Next i
end sub

 
Reply With Quote
 
 
 
 
Greg Glynn
Guest
Posts: n/a
 
      31st Aug 2011
Sub CaptionShapes()

'Changes the Captiosn on all shapes on all Worksheets

Dim Wks As Worksheet
Dim myshape As Shape

For Each Wks In Worksheets
With Wks
'Loop through the Shapes collection
For Each myshape In ActiveSheet.Shapes
myshape.Select
With Selection
.Characters.Text = "Caption Text"
End With
Next myshape
End With
Next Wks
End Sub

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the Caption on a Worksheet Label AhrenL Microsoft Excel Charting 1 18th May 2006 09:23 PM
Changing a Label (Shapes) Caption Value on a Worksheet AhrenL Microsoft Excel Programming 1 18th May 2006 09:22 PM
Label - Caption not changing Brian Hribek Microsoft Excel Programming 0 11th Oct 2004 10:02 PM
Label - Caption not changing Brian Hribek Microsoft Excel Programming 1 11th Oct 2004 09:19 PM
changing the caption of a label Koos Microsoft Excel Programming 4 18th Oct 2003 02:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:05 PM.