troubleshooting Question

Problem to SaveAs line

Avatar of Peter Chan
Peter ChanFlag for Hong Kong asked on
Programming Languages-OtherMicrosoft OfficeVisual Basic ClassicMicrosoft ExcelVBA
14 Comments1 Solution328 ViewsLast Modified:
I did get
due to SaveAs line below. Why?
    Dim Time0 As Boolean, cnt0 As Integer, File0 As String, Title0 As String, Window0 As String, RowID0 As String, Var1 As String, Var2 As String, Var3 As String, Var4 As String, Var5 As String, Var6 As String, Var7 As String, Var8 As String, Var9 As String, Var10 As String, Var11 As String
    Time0 = True: cnt0 = 1: File0 = Application.ActiveWorkbook.Path & "\Departure List (of People already left).xls": Title0 = "Departure List (of People already left)": Window0 = "Departure List (of People already left).xls"
Rep0:   'Windows(Window1).Activate
    'Debug.Print Window1
    With ThisWorkbook.Worksheets("Main Sheet").Range("AJ1:AJ50000")
        Set c = .Find(Search0, LookIn:=xlValues)
        If Not c Is Nothing Then
            Var1 = ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 3).Value
            Var2 = ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 4).Value
            Var3 = ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 5).Value
            Var4 = ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 6).Value
            Var5 = ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 7).Value
            Var6 = CStr(ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 8).Value)
            Var7 = ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 9).Value
            Var8 = CStr(ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 16).Value)
            Var9 = CStr(ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 17).Value)
            Var10 = CStr(ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 19).Value)
            Var11 = ThisWorkbook.Worksheets("Main Sheet").Cells(c.Row, 20).Value
            RowID0 = CStr(c.Row) & "CC"
            If cnt0 = 1 Then
                Set HOBook = Workbooks.Add
                With HOBook
                    .Title = Title0
                    .Subject = Title0
                    .SaveAs Filename:=File0, FileFormat:=XlFileFormat.xlOpenXMLWorkbookMacroEnabled
                    .Close SaveChanges:=False
                End With
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 14 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros