snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Sub SaveAsName()
Dim FName As String
Dim FPath As String
FPath = "D:\Report"
FName = Sheets("INPUT").TextBox1.Text
ThisWorkbook.Saveas Filename:=FPath & "\" & FName + ".xls"
End Sub
Dim FName As String
Dim FPath As String
Dim ckb As Object
FPath = "D:\Report"
FName = Sheets("INPUT").TextBox1.Text
With Sheets("INPUT")
For Each ckb In .OLEObjects
If Left(ckb.Name, 5) = "Check" Then
If ckb.Object.Value = True Then
With Sheets("Report")
.Label1.Caption = ckb.Object.Caption
ThisWorkbook.Sheets("Report").Copy
ActiveWorkbook.SaveAs Filename:=FPath & "\" & FName & .Label1.Caption + ".xls"
ActiveWorkbook.Close False
End With
End If
End If
Next ckb
End With
Dim FName As String
Dim FPath As String
Dim ckb As Object
FPath = "D:\Report"
FName = Sheets("INPUT").TextBox1.Text
With Sheets("INPUT")
For Each ckb In .OLEObjects
If Left(ckb.Name, 5) = "Check" Then
If ckb.Object.Value = True Then
With Sheets("Report")
.Label1.Caption = ckb.Object.Caption
ThisWorkbook.Sheets("Report").Copy
ActiveWorkbook.SaveAs Filename:=FPath & "\" & FName & .Label1.Caption + ".xls"
ActiveWorkbook.Close False
End With
End If
End If
Next ckb
End With
Dim FName As String
Dim FPath As String
Dim ckb As Object
FPath = "D:\Report"
FName = Sheets("INPUT").TextBox1.Text
With Sheets("INPUT")
For Each ckb In .OLEObjects
If Left(ckb.Name, 5) = "Check" Then
If ckb.Object.Value = True Then
With Sheets("Report")
.Label1.Caption = ckb.Object.Caption
ThisWorkbook.Sheets("Report").Copy
ActiveWorkbook.SaveAs Filename:=FPath & "\" & FName & .Label1.Caption + ".xls"
ActiveWorkbook.Close False
End With
End If
End If
Next ckb
End With
Dim FName As String
Dim FPath As String
Dim ckb As Object
FPath = "D:\Report"
FName = Sheets("INPUT").TextBox1.Text
With Sheets("INPUT")
For Each ckb In .OLEObjects
If Left(ckb.Name, 5) = "Check" Then
If ckb.Object.Value = True Then
With Sheets("Report")
.Label1.Caption = ckb.Object.Caption
ThisWorkbook.Sheets("Report").Copy
ActiveWorkbook.SaveAs Filename:=FPath & "\" & FName & .Label1.Caption + ".xls"
ActiveWorkbook.Close False
End With
End If
End If
Next ckb
End With