Hi,
I have a macro that currently extracts data from a workbook and creates a new workbook, which i would then like to save and close this newly created workbook as a csv.
I only need to set the save path once, so if i could include this path in the code, that would be great. I believe CSV's have pop ups when saving too with regards to saving and losing formatting etc, if they can be avoided to that would be great.
The current code i have for the creation is
Public Sub OrderCreation()
Dim newWB As Workbook, currentWB As Workbook
Dim newS As Worksheet, currentS As Worksheet
Dim ShtsCnt As Integer
'Copy the data you need
'Set currentWB = ThisWorkbook
'Set currentS = currentWB.Sheets("UploadSheetTemplate")
Sheets("UploadSheetTemplate").Visible = True
Sheets("UploadSheetTemplate").Select
Sheets("UploadSheetTemplate").Range("A:D").Select
Selection.Copy
Sheets("UploadSheetTemplate").Visible = False
'Create a new file that will receive the data
'ShtsCnt = .SheetsInNewWorkbook
'.SheetsInNewWorkbook = 1
Set newWB = Workbooks.Add
'.SheetsInNewWorkbook = ShtsCnt
With newWB
Set newS = newWB.Sheets("Sheet1")
newS.Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
'Save in CSV
Application.DisplayAlerts = False
Application.DisplayAlerts = True
End With
End Sub
Hopefully that makes sense and any help would be much appreciated.
Thanks in advance
Marcosis
Bookmarks