VBA to copy a table generated by PowerQuery to a new workbook without copying query too

justmeok

New Member
Joined
Jul 27, 2011
Messages
42
Office Version
  1. 365
Platform
  1. Windows
Hi All :)

I have a simple macro that copies a worksheet to a new workbook and saves it to a different location. When I use this macro to copy a table that was generated by a power query within the workbook to a new workbook it also copies the query. I have no idea how to amend the macro to just copy the table and not the query as well. Is this even possible?
Code:
Sub Save_ActiveSheet_As_New_Workbook()
'save worksheet to new workbook in specified folder with same name as worksheet
    ActiveSheet.Copy
Application.DisplayAlerts = False
    With ActiveWorkbook
        .SaveAs "E:\Accounts\Current Tables\" & .Sheets(1).Name
Application.DisplayAlerts = True
        .Close 0
    End With

I would very much appreciate some help :)
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Anyone out there able to help please?
I am also interested in how this works. Especially since the dependent queries and connections are also copied when several tables are copied for each individual table. These are then given a consecutive numbering as a suffix in the new folder ((2), (3), (4), ...).
 
Upvote 0
I would Paste Values only to a New Workbook, and Save the new Workbook.
 
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,923
Members
448,533
Latest member
thietbibeboiwasaco

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