WEEKNUM in PowerPoint

apurk45

Board Regular
Joined
Oct 23, 2002
Messages
221
Hello
I'm not sure if my question belongs to this board or someplace else, but let me try it.
I am trying to replace "CW" text in a Text Box in the PowerPoint slide with "CW41" where 41 represents the current week number (WEEKNUM). I will do this on a weekly basis, so the #41 will keep advancing to subsequent #s.
Here is the code I have in the PowerPoint slide (opened from XLS using VBA). Unfortunately, my attempt to automate the numbering process is not working.
Any help would be greatly appreciated

John

1633492769563.png



VBA Code:
Sub Find_Replace()
'
Dim sld As Slide
Set sld = ActivePresentation.Slides(1)
Dim shp As Shape
For Each shp In sld.Shapes
If shp.HasTextFrame Then
shp.TextFrame.TextRange.Text = Replace(shp.TextFrame.TextRange.Text, "CW", "CW" & WeekNum(today()))
shp.TextFrame.TextRange.Characters(32, 39).Font.Bold = msoFalse
'
End If
Next shp
End Sub
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,215,352
Messages
6,124,449
Members
449,160
Latest member
nikijon

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