I am trying to copy an active sheet to a new workbook with the following. The problem is that it is truncating
some of the cells that have too much text. Is there a way to make this work?
[vba]Option Explicit
Sub CreateSpecificationFile()
Dim NewName As String
Dim nm As Name
Dim ws As Worksheet
If MsgBox("Finalize ans save new speification file?" & vbCr & _
"This specification will be saved as selected" _
, vbYesNo, "New Specification") = vbNo Then Exit Sub
With Application
.ScreenUpdating = False
' Copy specific sheets
' *SET THE SHEET NAMES TO COPY BELOW*
' Array("Sheet Name", "Another sheet name", "And Another"))
' Sheet names go inside quotes, seperated by commas
On Error GoTo ErrCatcher
Sheets(Array("PK12002")).Copy
On Error GoTo 0
For Each ws In ActiveWorkbook.Worksheets
ws.Cells.Copy
ws.[a1].PasteSpecial Paste:=xlValues
ws.Cells.Hyperlinks.Delete
Application.CutCopyMode = False
Cells(1, 1).Select
ws.Activate
Next ws
Cells(1, 1).Select
' Remove named ranges
For Each nm In ActiveWorkbook.Names
nm.Delete
Next nm
' Remove column E from new worksheet
Range("E:E").Delete
' Input box to name new file
NewName = InputBox("ENTER A NAME FOR THIS SPECIFICATION New file _
will be saved in the original directory the master file is in.", "Name Specification File")
' Save it with the NewName and in the same directory as original
ActiveWorkbook.SaveCopyAs ThisWorkbook.Path & "\" & NewName & ".xls"
ActiveWorkbook.Close False
ActiveWorkbook.Close False
.ScreenUpdating = False
End With
Exit Sub
ErrCatcher:
MsgBox "Specified sheets do not exist within this workbook"
End Sub[/vba]