Formatting on pivot table being created by a Macro that runs on a loop through names and items to produce a number of invoices

ben_1977

New Member
Joined
Sep 8, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi, The below macro originally worked fine, but now, for some reason, the new copied worksheet is not saving any of the cell properties.
The macro ran through a list of names and then repopulated the pivot table on the worksheet for that person, thus creating a small invoice with the list of items and total in a smaller version of the table; but now the properties (cell border and formatting) disappear from the newly created sheets. The code is:

VBA Code:
Sub Save_Sheets_To_New_Books() 'INVOICES

Const strWbPath As String = "D:\Accounts\EA Letters\2020 09 September\"

Dim strDate As String 'todays date

'save the sheets to new books within the active folder and print them

Application.ScreenUpdating = False

Application.Calculation = xlCalculationManual

strDate = Format(Date, "yyyy.mm.dd") '(Date, "yyyy.mm.dd") THIS IS WHERE THE ERROR OCCURS the word DATE is highlighted

ActiveSheet.Copy

Call DeleteNamedRanges

Call PrintAreaAndPasteSpecial

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=strWbPath & Name_of_Artist & "_" & strDate & ".pdf" _

, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _

:=False, OpenAfterPublish:=False

ActiveWorkbook.SaveAs FileName:=strWbPath & Name_of_Artist & "_" & strDate & ".xlsx"

Application.DisplayAlerts = True

'ActiveSheet.PrintOut Copies:=1, Collate:=True 'remove the comment if you want to print it out as well

ActiveWorkbook.Close False

Application.Calculation = xlCalculationAutomatic

Application.ScreenUpdating = True

End Sub

Please could any offer any assistance.

Many Thanks


Thanks in advance.
 
Last edited by a moderator:

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,224,825
Messages
6,181,191
Members
453,021
Latest member
pingpong7117

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top