我有以下代码,可以在工作簿中创建工作表的导出。但是,一旦创建了新工作表,我需要它来粘贴值以删除准备好发送给其他人的公式。
我是否可以在此代码中使用为该文件指定的名称,例如' with'声明然后告诉它粘贴值?(输入密码后新书打开)
Dim password As Variant
password = Application.InputBox("Enter Password Here", "Export Document Password")
Select Case password
Case Is = False
Exit Sub
Case Is = "**********"
Dim FName As String
Dim FPath As String
Dim NewBook As Workbook
FPath = "H:\Headoffice\Finance\Sales\Exports for Finance"
FName = "Client Finances " & Sheets("Board Information").Range("b7").Text & Format(Now, "ddmmyy") & ".xls"
Set NewBook = Workbooks.Add
ThisWorkbook.Sheets("Board Information").Copy Before:=NewBook.Sheets(1)
If Dir(FPath & "\" & FName) <> "" Then
MsgBox "File " & FPath & "\" & FName & " already exists"
Else
NewBook.SaveAs Filename:=FPath & "\" & FName
MsgBox " Saved @ H:\Headoffice\Finance\Sales\Exports for Finance"
End If
Exit Sub
Case Else
MsgBox "Incorrect Password"
End Select
End Sub