Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Change multiple object group name

Hi all,

Whilst the code below changes all button names from GW2opt to GW4opt is
there a way to change group names e.g. change group 1a to 1a4 but using a
wildcard char to replace 1a since I have groups 1b, 1c, etc. Simply, Iwant
to add 4 to all group names!

Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj
.Name = Replace(.Name, "GW2opt", "GW4opt")

End With
Next OleObj
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Change multiple object group name

Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj.Object
.GroupName = Replace(.GroupName, .GroupName, .GroupName & "4")
End With
Next OleObj

End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"GreenBean" wrote in message
...
Hi all,

Whilst the code below changes all button names from GW2opt to GW4opt is
there a way to change group names e.g. change group 1a to 1a4 but using a
wildcard char to replace 1a since I have groups 1b, 1c, etc. Simply,

Iwant
to add 4 to all group names!

Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj
.Name = Replace(.Name, "GW2opt", "GW4opt")

End With
Next OleObj
End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Change multiple object group name


"Bob Phillips" wrote in message
...
Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj.Object
.GroupName = Replace(.GroupName, .GroupName, .GroupName & "4")
End With
Next OleObj

End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"GreenBean" wrote in message
...
Hi all,

Whilst the code below changes all button names from GW2opt to GW4opt is
there a way to change group names e.g. change group 1a to 1a4 but using a
wildcard char to replace 1a since I have groups 1b, 1c, etc. Simply,

Iwant
to add 4 to all group names!

Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj
.Name = Replace(.Name, "GW2opt", "GW4opt")

End With
Next OleObj
End Sub



Hi Bob,

I've tried the scipt and it doesn't like it - get run time error 438...I
tried something similar but with same outcome....


  #4   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Change multiple object group name


"GreenBean" wrote in message
...

"Bob Phillips" wrote in message
...
Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj.Object
.GroupName = Replace(.GroupName, .GroupName, .GroupName & "4")
End With
Next OleObj

End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"GreenBean" wrote in message
...
Hi all,

Whilst the code below changes all button names from GW2opt to GW4opt is
there a way to change group names e.g. change group 1a to 1a4 but using
a
wildcard char to replace 1a since I have groups 1b, 1c, etc. Simply,

Iwant
to add 4 to all group names!

Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj
.Name = Replace(.Name, "GW2opt", "GW4opt")

End With
Next OleObj
End Sub



Hi Bob,

I've tried the scipt and it doesn't like it - get run time error 438...I
tried something similar but with same outcome....

Sri Bob - tell a lie - it works once - didn't see the change first
time!!!ooops

Is there a way to use wild card since if I want to change 1a4 to 1a5 the
scipt will currently give 1a44?

tia


  #5   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 27,285
Default Change multiple object group name

Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj.Object
.GroupName = Left(.GroupName,len(.GroupName)-1) & "5"
End With
Next OleObj

End Sub


--
Regards,
Tom Ogilvy


"GreenBean" wrote in message
...

"GreenBean" wrote in message
...

"Bob Phillips" wrote in message
...
Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj.Object
.GroupName = Replace(.GroupName, .GroupName, .GroupName &
"4")
End With
Next OleObj

End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"GreenBean" wrote in message
...
Hi all,

Whilst the code below changes all button names from GW2opt to GW4opt is
there a way to change group names e.g. change group 1a to 1a4 but using
a
wildcard char to replace 1a since I have groups 1b, 1c, etc. Simply,
Iwant
to add 4 to all group names!

Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj
.Name = Replace(.Name, "GW2opt", "GW4opt")

End With
Next OleObj
End Sub



Hi Bob,

I've tried the scipt and it doesn't like it - get run time error 438...I
tried something similar but with same outcome....

Sri Bob - tell a lie - it works once - didn't see the change first
time!!!ooops

Is there a way to use wild card since if I want to change 1a4 to 1a5 the
scipt will currently give 1a44?

tia





  #6   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Change multiple object group name


"Tom Ogilvy" wrote in message
...
Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj.Object
.GroupName = Left(.GroupName,len(.GroupName)-1) & "5"
End With
Next OleObj

End Sub


--
Regards,
Tom Ogilvy


"GreenBean" wrote in message
...

"GreenBean" wrote in message
...

"Bob Phillips" wrote in message
...
Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj.Object
.GroupName = Replace(.GroupName, .GroupName, .GroupName &
"4")
End With
Next OleObj

End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"GreenBean" wrote in message
...
Hi all,

Whilst the code below changes all button names from GW2opt to GW4opt
is
there a way to change group names e.g. change group 1a to 1a4 but
using a
wildcard char to replace 1a since I have groups 1b, 1c, etc. Simply,
Iwant
to add 4 to all group names!

Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj
.Name = Replace(.Name, "GW2opt", "GW4opt")

End With
Next OleObj
End Sub



Hi Bob,

I've tried the scipt and it doesn't like it - get run time error 438...I
tried something similar but with same outcome....

Sri Bob - tell a lie - it works once - didn't see the change first
time!!!ooops

Is there a way to use wild card since if I want to change 1a4 to 1a5 the
scipt will currently give 1a44?

tia


Sorry Tom - didn't work first time then did! Must be losing it tonight.
Both now work but always end in runtime error 439 - object not supported -
is there a way to fix that?


  #7   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 27,285
Default Change multiple object group name

This worked fine for me:

Public Sub ChangeButtonGroupName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
If TypeOf OleObj.Object Is MSForms.OptionButton Then
With OleObj.Object
.GroupName = Left(.GroupName, Len(.GroupName) - 1) & "5"
End With
End If
Next OleObj

End Sub


--
Regards,
Tom Ogilvy

"GreenBean" wrote in message
...

"Tom Ogilvy" wrote in message
...
Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj.Object
.GroupName = Left(.GroupName,len(.GroupName)-1) & "5"
End With
Next OleObj

End Sub


--
Regards,
Tom Ogilvy


"GreenBean" wrote in message
...

"GreenBean" wrote in message
...

"Bob Phillips" wrote in message
...
Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj.Object
.GroupName = Replace(.GroupName, .GroupName, .GroupName &
"4")
End With
Next OleObj

End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"GreenBean" wrote in message
...
Hi all,

Whilst the code below changes all button names from GW2opt to GW4opt
is
there a way to change group names e.g. change group 1a to 1a4 but
using a
wildcard char to replace 1a since I have groups 1b, 1c, etc. Simply,
Iwant
to add 4 to all group names!

Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj
.Name = Replace(.Name, "GW2opt", "GW4opt")

End With
Next OleObj
End Sub



Hi Bob,

I've tried the scipt and it doesn't like it - get run time error
438...I tried something similar but with same outcome....
Sri Bob - tell a lie - it works once - didn't see the change first
time!!!ooops

Is there a way to use wild card since if I want to change 1a4 to 1a5 the
scipt will currently give 1a44?

tia


Sorry Tom - didn't work first time then did! Must be losing it tonight.
Both now work but always end in runtime error 439 - object not supported -
is there a way to fix that?



  #8   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Change multiple object group name


"Tom Ogilvy" wrote in message
...
This worked fine for me:

Public Sub ChangeButtonGroupName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
If TypeOf OleObj.Object Is MSForms.OptionButton Then
With OleObj.Object
.GroupName = Left(.GroupName, Len(.GroupName) - 1) & "5"
End With
End If
Next OleObj

End Sub


--
Regards,
Tom Ogilvy

"GreenBean" wrote in message
...

"Tom Ogilvy" wrote in message
...
Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj.Object
.GroupName = Left(.GroupName,len(.GroupName)-1) & "5"
End With
Next OleObj

End Sub


--
Regards,
Tom Ogilvy


"GreenBean" wrote in message
...

"GreenBean" wrote in message
...

"Bob Phillips" wrote in message
...
Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj.Object
.GroupName = Replace(.GroupName, .GroupName, .GroupName &
"4")
End With
Next OleObj

End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"GreenBean" wrote in message
...
Hi all,

Whilst the code below changes all button names from GW2opt to GW4opt
is
there a way to change group names e.g. change group 1a to 1a4 but
using a
wildcard char to replace 1a since I have groups 1b, 1c, etc.
Simply,
Iwant
to add 4 to all group names!

Public Sub ChangeButtonName()
Dim OleObj As OLEObject

For Each OleObj In ActiveSheet.OLEObjects
With OleObj
.Name = Replace(.Name, "GW2opt", "GW4opt")

End With
Next OleObj
End Sub



Hi Bob,

I've tried the scipt and it doesn't like it - get run time error
438...I tried something similar but with same outcome....
Sri Bob - tell a lie - it works once - didn't see the change first
time!!!ooops

Is there a way to use wild card since if I want to change 1a4 to 1a5
the scipt will currently give 1a44?

tia


Sorry Tom - didn't work first time then did! Must be losing it tonight.
Both now work but always end in runtime error 439 - object not
supported - is there a way to fix that?


thx Tom - working great now....


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Icon for inserted file object doesn't collapse away when closeoutline group Paul Excel Discussion (Misc queries) 2 April 1st 08 10:46 PM
Object error with Group & Ungroup in Excel Denis J. Excel Worksheet Functions 0 May 10th 07 11:26 AM
Change multiple object group name GreenBean Excel Discussion (Misc queries) 7 July 23rd 06 10:27 PM
Data, Group got error message Cannot shift object off sheet Matt Excel Discussion (Misc queries) 1 October 4th 05 12:12 AM
what object group does this reside in Ricky M. Medley Excel Programming 1 December 9th 03 11:29 PM


All times are GMT +1. The time now is 10:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"