bloodmilksky
Board Regular
- Joined
- Feb 3, 2016
- Messages
- 202
Hi Guys,
I am using the below code to save a sheet as a workbook. my query is that when I do run it a notification comes up saying:
"parts of this workbook you are trying to save can not be saved macro free : VB Project"
I just wondered if there is a way of saving this as a macro free workbook
Many thanks
Jamie
I am using the below code to save a sheet as a workbook. my query is that when I do run it a notification comes up saying:
"parts of this workbook you are trying to save can not be saved macro free : VB Project"
I just wondered if there is a way of saving this as a macro free workbook
Many thanks
Jamie
Code:
Sub Copy_Save_Worksheet_As_Workbook()
Dim wb As Workbook
Dim myPath As String
Dim myFilename As String
Dim myFileExtension As String
myPath = "D:\" 'you can change this
myFileExtension = ".xlsx"
myFilename = ThisWorkbook.Sheets("EDI template").Range("REFNUMBER").Value
Set wb = Workbooks.Add
ThisWorkbook.Sheets("EDI template").Copy Before:=wb.Sheets(1)
ActiveSheet.UsedRange.Value = ActiveSheet.UsedRange.Value
wb.SaveAs myPath & myFilename & myFileExtension
wb.Close False
Msg = "Would You Like To Load Another Order ? " & Application.UserName
Ans = MsgBox(Msg, vbYesNo)
If Ans = vbNo Then
Range("Description").Select
Selection.ClearContents
Range("PXINFOR").Select
Selection.ClearContents
Application.DisplayAlerts = False
ThisWorkbook.Save
Application.DisplayAlerts = True
Application.Quit
End If
If Ans = vbYes Then
Range("PXINFOR").Select
Selection.ClearContents
Range("Description").Select
Selection.ClearContents
Run "NextOrder"
End If
End Sub