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
Bookmarks