Copy & Paste from One Workbook to a Macroed Template Workbook

V

VickiMc

Hello.
What I want to do is Open a Macroed Template Workbook (via Macro) from
another workbook.

The Template Workbook has ActiveSheet Protection & other macros which need
to be disabled prior to copying & pasting from My Workbook.

At the moment what I have been doing is Enabling the Macros on Open, then
running an ActiveSheet Unprotect macro, closing the file, then re-opening it
with Macros disabled, then copying & pasting a range from My Workbook.

I then use Save As and rename the New (Template) File.

My aim is to develop the files (& their automation), then pass both onto
another user, so ideally I want to bypass the Enable, Disable Close Re-open
portion before I do this.

Any ideas?
 
A

Atishoo

I think you have already done it!
I take it you have been recording macros rather than editing directly in the
VBA editor!
Keeping it simple if you go to your macro then click "step into" you can see
the recorded code. you could then copy and paste the active sheet unprotect
macro, workbook open macro and save rename macro all into one macro.

the code to open a workbook would be:
Sub OpenUp()
Workbooks.Open("C:\MyFolder\MyBook.xls")
ActiveWorkbook.Unprotect

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