I have a sheet with table formatting that I need to keep when copy / paste special. However I want to delete all the power query connections. Ive been able to accomplish this manually by going into document inspector and removing all wherever possible. I recorded a macro which displayed results however this doesnt work when i try to actually use the code.
Here is the VBA code I'm using. This code copys a sheet from one workbook, creates a new workbook and pastes special all using source theme. The .REmoveDocumentInformation (xlRDIPrinterPath) is what I got from the macro recording that doesn't seem to do anything when I put it to use.
Set NewWB = Workbooks.Add
ThisWorkbook.Worksheets(1).Cells.Copy
NewWB.Activate
Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.RemoveDocumentInformation (xlRDIPrinterPath)
NewWB.SaveAs FilePath, FileFormat:=XlFileFormat.xlWorkbookDefault
NewWB.Close (False)
Set NewWB = Nothing
Bookmarks