Results 1 to 3 of 3

Trouble Shoot My Book please

Threaded View

  1. #1
    Forum Contributor
    Join Date
    01-09-2016
    Location
    Surrey B.C.
    MS-Off Ver
    2013
    Posts
    155

    Trouble Shoot My Book please

    The following Macro Works in all facets. Except For some reason two of the new books that it is saving, is saving it as a file "TYPE" that i do not recognize.

    This just started happening.

    Can someone try this, or maybe explain why two of the books may be screwing up?


    Here are the two areas not being saved as the right file type properly

    2. Save an XLSX file of sheet ("Terrance Labor Tracker") with a new name from cells ("B4, B8, D8, D9") LOCATED in sheet("T LABOR TRACKER")
    'This new File would be saved in the new folder created in step 1.
        With Sheets("Terrance Labor Tracker")
            sArray = Array(.Name)
            fName = .Range("B4") & .Range("B8") & .Range("D8") & .Range("D9")
            Call CreateFile(sArray, Fpath & fName)
        End With
        
        
        
    Call DoYou
    
    
    '3. Save an XLSX file of the two sheets ("Stocked Items") & ("Stocked Prices") with a new name from cells ("K1, A5, A11, A13") LOCATED in sheet("Stocked Items")
    'This new File would be saved in the new folder created in step 1.
        With Sheets("Stocked Items")
            sArray = Array(.Name)
            fName = .Range("K1") & .Range("A5") & .Range("A13") & .Range("A11")
            Call CreateFile(sArray, Fpath & fName)
        End With
        
      
    Call DoYou
    Here is the entire code

    Private Sub CreateFile(sheetArray As Variant, PathAndName)
    Dim aSheet As Variant, wb As Workbook, rng As Range, cel As Range
    Application.DisplayAlerts = False
        Set wb = workbooks.Add
            For Each aSheet In sheetArray
                ThisWorkbook.Sheets(aSheet).Copy Before:=wb.Sheets(1)
                Set rng = ThisWorkbook.Sheets(aSheet).UsedRange
                For Each cel In rng
                    With wb.Sheets(aSheet)
                        If cel.HasFormula Then
                            .Range(cel.Address(0, 0)) = ""
                            .Range(cel.Address(0, 0)).Formula = cel.Formula
                        End If
                    End With
                Next cel
            Next aSheet
        wb.SaveAs PathAndName
        wb.Close False
    
    Application.DisplayAlerts = True
    End Sub
    
    Sub AnewFolder()
    
     
    
     Dim Answer As VbMsgBoxResult
            
         Answer = MsgBox("Do You want to Save A New Client Folder?", vbYesNo, "Run Macro")
            
        If Answer = vbYes Then
    
        Call acustomerID
    
        Call COMPLETECells
     
        Call DATEEST
     
        
        Call AddressandName
    
    Dim WS1 As Worksheet:   Set WS1 = Sheets("6 Estimate Print")
    Dim wb As Workbook, sArray As Variant
    Dim Fpath As String, pdfName As String, fName As String
    
    
    '1. Create a new folder with a new name from cells ("A13, C8, C9") the cells are located in ("6 Estimate Print") NOTE (*This sheet will not be saved at this time.*)
    'The new Folder would be subfolder of Drywall
    
        Fpath = "C:\Users\Terrance\Dropbox\MCD&F Terrance\1 Drywall Steel Estimates\Drywall Estimates" & "\" & WS1.Range("A13") & WS1.Range("C8") & WS1.Range("C9")
        MkDir Fpath
        Fpath = Fpath & "\"
    
    
        
    Call DoYou
    
        
       
    '2. Save an XLSX file of sheet ("Terrance Labor Tracker") with a new name from cells ("B4, B8, D8, D9") LOCATED in sheet("T LABOR TRACKER")
    'This new File would be saved in the new folder created in step 1.
        With Sheets("Terrance Labor Tracker")
            sArray = Array(.Name)
            fName = .Range("B4") & .Range("B8") & .Range("D8") & .Range("D9")
            Call CreateFile(sArray, Fpath & fName)
        End With
        
        
        
    Call DoYou
    
    
    '3. Save an XLSX file of the two sheets ("Stocked Items") & ("Stocked Prices") with a new name from cells ("K1, A5, A11, A13") LOCATED in sheet("Stocked Items")
    'This new File would be saved in the new folder created in step 1.
        With Sheets("Stocked Items")
            sArray = Array(.Name)
            fName = .Range("K1") & .Range("A5") & .Range("A13") & .Range("A11")
            Call CreateFile(sArray, Fpath & fName)
        End With
        
      
    Call DoYou
      
    
    '4. Save an XLSX file of sheet ("CONTRACT JOB TRACKER") with a new name from cells ("G3, B5, B12, B10 ") LOCATED in sheet("CONTRACT JOB TRACKER")
    'This new File would be saved in the new folder created in step 1.
        With Sheets("CONTRACT JOB TRACKER")
            sArray = Array(.Name)
            fName = .Range("G3") & .Range("B5") & .Range("B12") & .Range("B10")
            Call CreateFile(sArray, Fpath & fName)
        End With
    
    Call DoYou
    
            
    '5. Save an XLSX file of sheet ("6 Estimate Print") with a new name from cells ("C6, D6, A13, C8, C9") LOCATED in sheet("6 Estimate Print")
    'This new File would be saved in A different folder that already exists.
        With WS1
            sArray = Array(.Name)
            fName = .Range("C6") & .Range("D6") & .Range("C8") & .Range("C9")
            Call CreateFile(sArray, Fpath & fName)
        End With
    
    
    Call DoYou
    
    '6. Save a PDF file of sheet ("6 Estimate Print") with a new name from cells ("C6, D6, A13, C8, C9") LOCATED in sheet("6 Estimate Print")
    
    With WS1
       pdfName = .Range("C6") & .Range("D6") & .Range("A13") & .Range("C8") & .Range("C9")
        .ExportAsFixedFormat Type:=xlTypePDF, fileName:=Fpath & pdfName
    End With
    
    Call ALLESTJOBSTOCKTLAB
    
    End If
    
    End Sub
    Here is the Book

    Any Help would be appreciated

    Thank you
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Automatically Open a Book when a specific book is opened
    By TBM in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2018, 11:53 AM
  2. Open Closed Book, carry out a VLookup and then put all entries into blank book
    By AChatwin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2015, 03:17 AM
  3. [SOLVED] how to change this macro so it makes sheets in a new book not in the current book
    By gavwalsh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-01-2015, 05:27 AM
  4. Penalty Shoot out Spread sheet
    By IOW Penalty Comp in forum Excel General
    Replies: 17
    Last Post: 01-08-2014, 02:40 AM
  5. Replies: 3
    Last Post: 12-27-2012, 12:26 PM
  6. [SOLVED] trouble shoot pointing to a cell
    By Tracy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-13-2005, 06:05 PM
  7. Open book, check for macros, close book
    By CLR in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-31-2005, 02:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1