私は現在の日付から次の木曜日の日付を取得し、最初のスライドに書き込もうとしています。今のところ私は現在の日付を持っていますが、私は次の木曜日の日付を取得する方法を見つけませんでした。例えば、私は火曜日23.08.2016に私のプレゼンテーションを開き、私のマクロが実行されるとき、私は最初のスライドで25.08.2016(木曜日に対応する)を取得したいと思います。現在の日付から次の木曜日の日付を取得するPowerPointマクロ
これまでのところ私が持っている:
Set objPPTX = CreateObject("PowerPoint.Application")
objPPTX.Visible = True
'Adding Date on First Slide
Set PPApp = GetObject(, "Powerpoint.Application")
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = ppViewSlide
PPApp.Visible = True
Set PPSlide = PPPres.Slides(PPApp.ActiveWindow.Selection.SlideRange.SlideIndex)
' Set PPshape = PPSlide.Shapes.AddShape(Type:=msoShapeRectangle, Left:=220, Top:=150, Width:=270, Height:=75)
Set PPshape1 = PPSlide.Shapes.AddTextbox(msoTextOrientationHorizontal, Left:=20, Top:=150, Width:=680, Height:=70)
With PPshape1
.TextFrame.TextRange.Text = "PT PM Weekly"
.TextFrame.TextRange.Font.Name = "Verdana"
.TextFrame.TextRange.Font.Color = vbBlack
.TextFrame.TextRange.Font.Size = 48
End With
Set PPshape = PPSlide.Shapes.AddTextbox(msoTextOrientationHorizontal, Left:=350, Top:=150, Width:=680, Height:=70)
With PPshape
Todate = DateValue(Now)
oldWeekDay = Weekday(Now)
Select Case Thursday
Case oldWeekDay = 1
.TextFrame.TextRange.Text = Format(Now + 4, " dd.mm.yyyy")
Case oldWeekDay = 2
.TextFrame.TextRange.Text = Format(Now + 3, " dd.mm.yyyy")
Case oldWeekDay = 3
.TextFrame.TextRange.Text = Format(Now + 2, " dd.mm.yyyy")
Case oldWeekDay = 4
.TextFrame.TextRange.Text = Format(Now + 1, " dd.mm.yyyy")
Case oldWeekDay = 5
.TextFrame.TextRange.Text = Format(Now, " dd.mm.yyyy")
Case oldWeekDay = 6
.TextFrame.TextRange.Text = Format(Now - 1, " dd.mm.yyyy")
Case oldWeekDay = 7
.TextFrame.TextRange.Text = Format(Now - 2, " dd.mm.yyyy")
End Select
.TextFrame.TextRange.Font.Name = "Verdana"
.TextFrame.TextRange.Font.Color = vbBlack
.TextFrame.TextRange.Font.Size = 48
End With
が、私は問題はケース構造になっていることだと思うので、最後に私は、現在の日付から4を取得します。このような
ご協力いただきありがとうございますが、私は何をしなければならないのか正確には分かりませんでしたか?私はこの解決策を見つけることができません – Zigouma
textframe.textrange.text = NEXT_THURSDAY(今)は、あなたが好きなら、新しいモジュールでこのコードをVBAコードに追加して使用する方法です。 –
それはthxを働かせます:) – Zigouma