如何将InputBox值分配给Header?

时间:2012-12-11 01:24:26

标签: excel vba

目前我的代码导致崩溃。

Sub headerDate()
Dim iReply As String

iReply = Application.InputBox("What is the input? ")
With ActiveSheet.pageSetup
    .CenterHeader = ""
    .RightHeader = _
    "                        Doc. No.: " & str(iReply) & Chr(10) & "Version: 2.3 (Modification f)" & Chr(10) & "Valid as of: 12/31/2012  "
End With
Application.PrintCommunication = True
Range("BI2").Select
End Sub

1 个答案:

答案 0 :(得分:1)

我认为您需要将Str更改为Cstr:

"Doc. No.: " & CStr(iReply) & Chr(10) & "Version: 2.3 (Modification f)" & Chr(10) ...