Solved VBA Code for SavingAs excel sheet without Message box!

October 14, 2016 at 17:22:27
Specs: Windows 64, AMD 6300/8GB
Hi,

I am trying to saveAs a macro-enabled workbook to xlsx format. The problem is every time excel shows warning message when the macro button is clicked-on.

Screenshot: http://screencast.com/t/yI3QmIT37t


Is there a way to turn the warning message off and saveAs anyway?

Also, is there a way to NOT carry over the VB_Project on the original macro-enabled excel to the new xlsx excel sheet?

Thanks in advance!

message edited by dollar5474


See More: VBA Code for SavingAs excel sheet without Message box!

Reply ↓  Report •


#1
October 14, 2016 at 20:48:29
✔ Best Answer
Try something like this. If it works, I'll tell you where I got it. If not, I'll work on something else.

As written, it will use the current file path and file name. If a .xlxs with that name already exists, it will overwrite it. Of course, that could be dealt with in multiple ways.

BTW...When asking for help with a macro that isn't working, it helps if you post the code so we can see it. Sometimes all it takes is slight tweak, which we can't do if we don't know what we are working with.

Sub SaveAsXLXS()
Dim x As String, y As String
 Application.DisplayAlerts = False
  x = ActiveWorkbook.Path
  y = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 5)
    ActiveWorkbook.SaveAs x & "/" & y & ".xlsx", FileFormat:=xlOpenXMLWorkbook
 Application.DisplayAlerts = True
End Sub

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Reply ↓  Report •

#2
October 17, 2016 at 09:09:49
Hi "DerbyDad03"

Your code works like a charm! Thanks for the note and the help. The reason I didn't put my code because I didn't wanted to confuse anyone like you with my poor coding skill. Thanks once again.


Reply ↓  Report •

#3
October 17, 2016 at 09:37:16
We don't judge, we teach.

If we see something in your code that can be done more efficiently, we'll simply point it out so that you can learn from it.

BTW, you might find this tutorial to be of interest:

http://www.computing.net/howtos/sho...

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Reply ↓  Report •

Related Solutions


Ask Question