snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
I need help with the code. I want that relevant tab to be exported in XLSX form as well in the relevant folder. I have tried different codes myself but unfortunately couldn't be succeeded.
Sub nn()
Dim wb As Workbook
On Error Goto Handler
Application.ScreenUpdating=False
Application.DisplayAlerts=False
Const X As String= "C:\ABC" & Sheets(1).Range("h3").Value &"_"&Format(Now,"HHMMSS")
Set wb=Workbooks.Add
Sheets("Invoice").Copy after:=wb.Sheets(wb.Sheets.Count)
wb.Sheets(1).Delete
wb.SaveAs Filename:=X &".xlsx'" ,Fileformat:=51
Sheets("invoice"). Activate
wb.Close
Handler:
Application.ScreenUpdating=True
Application.DisplayAlerts=True
End Sub
Thank you for kind help
You do not have the required permissions to view the files attached to this post.
Sub nn()
Dim wb As Workbook
Dim X As String
On Error GoTo Handler
Application.ScreenUpdating = False
Application.DisplayAlerts = False
X = "C:\ABC" & Sheets(1).[H3] & "_" & Format(Now, "HHMMSS") & ".xlsx"
Set wb = Workbooks.Add
ThisWorkbook.Sheets("Invoice").Copy after:=wb.Sheets(wb.Sheets.Count)
wb.Sheets(1).Delete
wb.SaveAs Filename:=X, FileFormat:=51
Sheets("invoice").Activate
wb.Close
Handler:
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub