Macro to save Single Page to another workbook

J

Jenny B.

Good Morning,

I have a question about developing a Macro that takes a single sheet (sheet
would be ActiveSheet) and move it from one Workbook and place it in another.
I've already created a Macro which can take an Active Page and save it to my
desktop, but I cannot quite figure out how to save it to an existing file.

My workbook is located on my Desktop and named "Docking Station". The below
code is what I set-up to originally to just save a single page to my desktop.

Any help would be much appreciated.

Thanks in advance - Jenny B.

Sub SaveName()

ActiveSheet.Move
ChDir "C:\Documents and Settings\My Name\Desktop"
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\My Name\Desktop\New File.xls",
FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False
End Sub
 
D

Dave Peterson

You could have your code open the Docking Station workbook and move the
worksheet into that workbook.

Then save the workbook and then close it.

This may give you a start:

Option Explicit
Sub SaveName()

Dim DockWkbk As Workbook
Dim ActWks As Worksheet

Set ActWks = ActiveSheet

Set DockWkbk = Workbooks.Open(Filename:="C:\yourpath\docking station.xls")

ActWks.Move _
before:=DockWkbk.Worksheets(1)

DockWkbk.Save
DockWkbk.Close savechanges:=False

End Sub
 
J

Jenny B.

Thank you so much. That worked just the way I was hoping it would and I'm so
happy I can finally put this task to rest.

Thank you so much for your prompt response and extremely helpful and
knowledgeable advice.

Have a great rest of the day - Jenny B.
 

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

Similar Threads


Top