我有以下代码:
Sub ppt()
Dim pptapp As PowerPoint.Application
Dim ppt As PowerPoint.Presentation
Dim slide As PowerPoint.slide
Dim shape As PowerPoint.shape
Dim var1 As String
Set pptapp = CreateObject("Powerpoint.Application")
pptapp.Visible = True
Set ppt = pptapp.Presentations.Open("X:\SSC_HR\SENS\Bedrijfsbureau\Rapportages\SENS referenten rapportage\Nieuwe ref rap template\SENS referent rapportage januari 2014.pot")
Set slide = ppt.Slides(1)
Set shape = slide.Shapes.AddTextbox(msoTextOrientationHorizontal, 100, 500, 100, 100)
var = InputBox("Insert weeknumber")
With shape
.TextFrame.TextRange = "Update call Jeroen van Breda Vriesman/Ton van der Linden" & vbNewLine & var1 & vbNewLine & "Tel nr: +31 (0)10 - 299 1002 code 59790989 "
.Line.Visible = True
.Width = 200
.Height = 200
.TextEffect.FontSize = 12
End With
With ppt
.SaveAs "C:\Documents and Settings\aa471714\Desktop\" & "SENS referentenrapporge - week" & var1
.Close
结束
End Sub
我有两个问题
我尝试使用此声明排列字体大小
.TextEffect.FontSize = 12
但这不起作用。任何人都知道这里出了什么问题。如果我在没有这条线的情况下运行它一切顺利。
如果我现在运行它,我必须插入一个数字。但那个数字不会出现在文件中。我已经尝试将昏暗变为
Dim var1 As Number
我收到一条未定义用户定义类型的错误。有谁知道这里出了什么问题?
答案 0 :(得分:0)
相反,请使用:
With shape
.TextFrame.TextRange = "Update call Jeroen van Breda Vriesman/Ton van der Linden" & vbNewLine & var1 & vbNewLine & "Tel nr: +31 (0)10 - 299 1002 code 59790989 "
.Line.Visible = True
.Width = 200
.Height = 200
.TextFrame.TextRange.Font.Size = 12
End With
你想要做
如果要保存数字,请将var1变为Long或其他数字类型;否则,如String