RePost - Creating WBooks

G

Geoff

Hi
I am still getting failure or error when trying to copy a wsheet into a
newly created wbook. The procedure is initiated from a cmdbutton on a
modeless form. Eventually it will become part of an add-in.
What am I doing wrong, can someone please assist.

T.I.A.

Geoff

This code fails because it only produces a 1 sheet wbook and my default 3.

Private Sub cmdExecute_Click()
If chkConfirm = True Then
cFilename = ThisWorkbook.Name
Workbooks(cFilename).Sheets(1).Copy
End If
End Sub

This adaptation from a recent Tom Ogilvy answer errors with 'Named argument
not found' at Destination, astrerisked.

Sub AddBooks()
Dim bkOld As Workbook, bkNew As Workbook, sh As Worksheet
Set bkOld = Workbooks("WBooks Test6.xls")
Set sh = bkOld.Worksheets(1)
Set bkNew = Workbooks.Add()
bkNew.SaveAs _
Filename:= _
"D:\Excel\AutoProcess\Test7 " & bkOld, _
FileFormat:=xlNormal, _
Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False
sh.Copy Destination:=bkNew.Worksheets(1).Range("A1") '''''' errors here
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top