|
試していませんし、後始末もエラー処理も省略しています(-_-;)
Dim strFilter As String
Dim strTitle As String
Dim varFileName As Variant
Set wb2 = Workbooks.Open(Filename:="★★.xls")
If wb2.Sheets("入金メモ").Range("A1").Value <> "" Then
rtn = MsgBox("Do you want to make a new book?", vbYesNo)
If rtn = vbYes Then
wb2.Sheets("入金メモ").Copy
Set wb1 = ActiveWorkbook
wb1.Sheets(1).Name = wb2.Sheets("入金メモ").Range("A1").Value
wb1.SaveAs Filename:=ThisWorkbook.Path & "\" & "【NEW】" & Format(wb2.Sheets("入金メモ").Range("M1").Value, "YYYY/MM/DD") & ".xls"
Else
strTitle = "Select the Book."
strFilter = "Excel File(*.xls),*.xls," & "全て(*.*),*.*"
varFileName = Application.GetOpenFilename(strFilter, 1, strTitle, False)
If varFileName = False Then
Else
Set wb1 = Workbooks.Open(Filename:=varFileName)
wb2.Sheets("入金メモ").Copy Before:=wb1.Sheets(1)
wb1.Sheets(1).Name = wb2.Sheets("入金メモ").Range("A1").Value
wb1.Save
End If
End If
Else
MsgBox "No Fund name." & Chr(13) & Chr(13) & "Check the Fund Name, please."
End If
End Sub
|
|