Vba code to save a worksheet as normal excel worksheet (without macros)

kenny9002

Board Regular
Joined
Aug 22, 2010
Messages
211
I currently have the following vba code that saves an excel worksheet as PDF:

Code:
' 1 Newly created file is saved as a PDF file
Path = "C:\Copy Invoices"
 
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
Path & "\" & sNewWorkbookName & " - " & [G5], Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
False

I should be very grateful if the above code could be changed/tweaked for me so that, instead of saving the worksheet as PDF, it would save the worksheet as normal Excel worksheet (without macros), in the same location/folder as shown above. I use Excel 2007 - 2013.

Thanks all for your kind help, and Merry Christmas to you all.

Kenny
 
Last edited:
Dear Fluff,

You are indeed a STAR! And I thank you for your patience with me, and the support you have given to me.

As I waited last night for your response, I decided to go back and read through Rondebruin's published piece, using the link that you provided earlier on.

In that piece, I came across where he advised on adding 'Type Numbers' of the shapes, controls and objects in the vba code to make it easier to delete the shapes, controls and objects. He also provided a code to help generate the Type numbers of all such shapes in a Workbook.

I used his code and found out that the Type number of the shapes that I use as command buttons is "1".

I went back, added the Type number to your own vba code (Post #6 ), and it worked perfectly well - just as I wanted it.

I have shown, below, how I added the Type number to your vba code and got it to work for me:

Code:
For Each Shp In ActiveSheet.Shapes
 If Shp.Type = 1 Then Shp.Delete
   Next Shp

Again, I can't thank you enough for your patience and kindness. I am also very grateful to this wonderful forum - mrexcel.com - for making very kind and helpful experts like you available on the forum to provide support to us all.

I wish you a great time throughout Christmas and a very happy new year.

Kenny
 
Upvote 0

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Glad you got it sorted & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,221,512
Messages
6,160,237
Members
451,632
Latest member
purpleflower26

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