thedeadzeds
Active Member
- Joined
- Aug 16, 2011
- Messages
- 445
- Office Version
- 365
- Platform
- Windows
Hi Guys,
I've copied some code from a previous workbook which saves the named workbooks as CSV's in a new loaction. I've amended the code as needed but I am now getting the following error.
'template cannot be accessed. The file may be corrupted, located on a server that is not responding, or read only'
I've build another template from scratch but I'm still getting the same error.
I've copied some code from a previous workbook which saves the named workbooks as CSV's in a new loaction. I've amended the code as needed but I am now getting the following error.
'template cannot be accessed. The file may be corrupted, located on a server that is not responding, or read only'
I've build another template from scratch but I'm still getting the same error.
VBA Code:
Sub CSV()
Dim ws As Worksheet, newWb As Workbook
Set MyRange = Sheets("Menu").Range("B2") 'with the name of a cell
Application.ScreenUpdating = False
For Each ws In Sheets(Array("template"))
ws.Copy
Set newWb = ActiveWorkbook
With newWb
.SaveAs Filename:="C:\Users\dave.jam\Documents\Pot\Readyt\To Upload\" & MyRange.Value & " " _
& ws.Name & " " & Range("A" & Rows.Count).End(xlUp).Row - 1 & " " & ".csv", FileFormat:=xlCSV
End With
Next ws
Application.ScreenUpdating = True
End Sub