I'm having two problems with code below. First it's not working, second I can't see how to find the problem.
I got some help from Richard Buttrey a few days ago with the code, and one thing I've not understood - and this is where the code is breaking - is the Sheet2 method. Is it a method? I can't find it documented.
So, how do I go about understand the code better, and what's not working? It fails at the line wsInitialSheet.Columns("A:C").Copy Sheet2.Range("A1")
Sub KeynoteExport()
' Version 2020-11-02_2224
Dim wsInitialSheet As Worksheet, sWorkbookNameShort As String
Set wsInitialSheet = ActiveSheet
sWorkbookNameShort = Left(ActiveWorkbook.Name, (InStrRev(ActiveWorkbook.Name, ".", -1, vbTextCompare) - 1))
wsInitialSheet.Columns("A:C").Copy Sheet2.Range("A1")
Sheet2.Copy
Application.DisplayAlerts = True 'False
ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path & "\" & sWorkbookNameShort & ".txt", FileFormat:=xlText, CreateBackup:=False
Application.DisplayAlerts = True
ActiveWorkbook.Close
End Sub
Bookmarks