Is it possible to add a new workbook based on a locked template The Next CEO of Stack OverflowAdd Workbook based on TemplateAdding new Workbook in VBA crashes Excel 2013Disable Password Prompt when opening workbook through VBACheck if workbook in SharePoint 365 is locked for editingExcel 2013 VBA wsheet.protect UserInterfaceOnly:=TrueCannot open new workbooks while a certain workbook is openOpen html file with Workbooks.Open allways in new workbookSaving new Excel document as macro-free workbook without promptAdd userform to a different workbook at runtimeExcel VBA: Create new workbooks from template based on sheet with data
The exact meaning of 'Mom made me a sandwich'
Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?
Legal workarounds for testamentary trust perceived as unfair
What does "Its cash flow is deeply negative" mean?
How to prove a simple equation?
Is it professional to write unrelated content in an almost-empty email?
If Nick Fury and Coulson already knew about aliens (Kree and Skrull) why did they wait until Thor's appearance to start making weapons?
Are police here, aren't itthey?
Is it convenient to ask the journal's editor for two additional days to complete a review?
I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin
How to avoid supervisors with prejudiced views?
Where do students learn to solve polynomial equations these days?
Is it possible to use a NPN BJT as switch, from single power source?
Does increasing your ability score affect your main stat?
Why does standard notation not preserve intervals (visually)
WOW air has ceased operation, can I get my tickets refunded?
Can you be charged for obstruction for refusing to answer questions?
Which one is the true statement?
Is there a way to save my career from absolute disaster?
Solving system of ODEs with extra parameter
Why is my new battery behaving weirdly?
Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?
Why the difference in type-inference over the as-pattern in two similar function definitions?
Some questions about different axiomatic systems for neighbourhoods
Is it possible to add a new workbook based on a locked template
The Next CEO of Stack OverflowAdd Workbook based on TemplateAdding new Workbook in VBA crashes Excel 2013Disable Password Prompt when opening workbook through VBACheck if workbook in SharePoint 365 is locked for editingExcel 2013 VBA wsheet.protect UserInterfaceOnly:=TrueCannot open new workbooks while a certain workbook is openOpen html file with Workbooks.Open allways in new workbookSaving new Excel document as macro-free workbook without promptAdd userform to a different workbook at runtimeExcel VBA: Create new workbooks from template based on sheet with data
I've got the following VBA code which Adds a new workbook based on a template.
Option Explicit
Public Sub AddTemplatedWB()
Workbooks.Add ( _
"C:VssBOXGeneric ProjectsPMC2template.xlsm" _
)
End Sub
This works except when the template is locked. Then I get the usual password prompt:
Clicking Cancel gives me an error in VBA:
Is there any way to supply the password directly when adding the workbook? (This seems particularly weird since you can supply a password when Opening a file.)
If not, is there any other way to achieve what I'm looking for, i.e. creating a new file in memory based on a locked file?
excel vba
add a comment |
I've got the following VBA code which Adds a new workbook based on a template.
Option Explicit
Public Sub AddTemplatedWB()
Workbooks.Add ( _
"C:VssBOXGeneric ProjectsPMC2template.xlsm" _
)
End Sub
This works except when the template is locked. Then I get the usual password prompt:
Clicking Cancel gives me an error in VBA:
Is there any way to supply the password directly when adding the workbook? (This seems particularly weird since you can supply a password when Opening a file.)
If not, is there any other way to achieve what I'm looking for, i.e. creating a new file in memory based on a locked file?
excel vba
add a comment |
I've got the following VBA code which Adds a new workbook based on a template.
Option Explicit
Public Sub AddTemplatedWB()
Workbooks.Add ( _
"C:VssBOXGeneric ProjectsPMC2template.xlsm" _
)
End Sub
This works except when the template is locked. Then I get the usual password prompt:
Clicking Cancel gives me an error in VBA:
Is there any way to supply the password directly when adding the workbook? (This seems particularly weird since you can supply a password when Opening a file.)
If not, is there any other way to achieve what I'm looking for, i.e. creating a new file in memory based on a locked file?
excel vba
I've got the following VBA code which Adds a new workbook based on a template.
Option Explicit
Public Sub AddTemplatedWB()
Workbooks.Add ( _
"C:VssBOXGeneric ProjectsPMC2template.xlsm" _
)
End Sub
This works except when the template is locked. Then I get the usual password prompt:
Clicking Cancel gives me an error in VBA:
Is there any way to supply the password directly when adding the workbook? (This seems particularly weird since you can supply a password when Opening a file.)
If not, is there any other way to achieve what I'm looking for, i.e. creating a new file in memory based on a locked file?
excel vba
excel vba
edited Mar 20 at 10:01
Anton Lahti
asked Mar 20 at 9:36
Anton LahtiAnton Lahti
606
606
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
This code should work for you, since you can supply the password during the call:
Public Sub AddTemplatedWB()
Workbooks.Open Filename:="C:VssBOXGeneric ProjectsPMC2template.xlsm", _
Password:="YourPassword"
End Sub
Edit:
I was looking it up, but it seems that Microsoft didn't provide a direct way to do it. Maybe because they thought that it's not practical to lock a template with a password.
One possible solution that pops to my mind is to create a copy of the
template and then opening it.
No, this opens the template. I want a new workbook based on a template.
– Anton Lahti
Mar 20 at 10:08
2
I was looking it up, but it seems that Microsoft didn't provide a direct way to do it. Maybe because they thought that it's not practical to lock a template with a password. One possible solution that pops to my mind is to create a copy of the template and then opening it.
– Louis
Mar 20 at 10:53
Can you accept my answer, since you used my solution to solve the issue? Thank you.
– Louis
Mar 21 at 18:04
add a comment |
No, there doesn't seem to be any way to do this.
What I ended up doing instead is copying the template to a temporary file, Opening with the password.
Then I made sure that the temporary file was deleted after I was done with it.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55257597%2fis-it-possible-to-add-a-new-workbook-based-on-a-locked-template%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
This code should work for you, since you can supply the password during the call:
Public Sub AddTemplatedWB()
Workbooks.Open Filename:="C:VssBOXGeneric ProjectsPMC2template.xlsm", _
Password:="YourPassword"
End Sub
Edit:
I was looking it up, but it seems that Microsoft didn't provide a direct way to do it. Maybe because they thought that it's not practical to lock a template with a password.
One possible solution that pops to my mind is to create a copy of the
template and then opening it.
No, this opens the template. I want a new workbook based on a template.
– Anton Lahti
Mar 20 at 10:08
2
I was looking it up, but it seems that Microsoft didn't provide a direct way to do it. Maybe because they thought that it's not practical to lock a template with a password. One possible solution that pops to my mind is to create a copy of the template and then opening it.
– Louis
Mar 20 at 10:53
Can you accept my answer, since you used my solution to solve the issue? Thank you.
– Louis
Mar 21 at 18:04
add a comment |
This code should work for you, since you can supply the password during the call:
Public Sub AddTemplatedWB()
Workbooks.Open Filename:="C:VssBOXGeneric ProjectsPMC2template.xlsm", _
Password:="YourPassword"
End Sub
Edit:
I was looking it up, but it seems that Microsoft didn't provide a direct way to do it. Maybe because they thought that it's not practical to lock a template with a password.
One possible solution that pops to my mind is to create a copy of the
template and then opening it.
No, this opens the template. I want a new workbook based on a template.
– Anton Lahti
Mar 20 at 10:08
2
I was looking it up, but it seems that Microsoft didn't provide a direct way to do it. Maybe because they thought that it's not practical to lock a template with a password. One possible solution that pops to my mind is to create a copy of the template and then opening it.
– Louis
Mar 20 at 10:53
Can you accept my answer, since you used my solution to solve the issue? Thank you.
– Louis
Mar 21 at 18:04
add a comment |
This code should work for you, since you can supply the password during the call:
Public Sub AddTemplatedWB()
Workbooks.Open Filename:="C:VssBOXGeneric ProjectsPMC2template.xlsm", _
Password:="YourPassword"
End Sub
Edit:
I was looking it up, but it seems that Microsoft didn't provide a direct way to do it. Maybe because they thought that it's not practical to lock a template with a password.
One possible solution that pops to my mind is to create a copy of the
template and then opening it.
This code should work for you, since you can supply the password during the call:
Public Sub AddTemplatedWB()
Workbooks.Open Filename:="C:VssBOXGeneric ProjectsPMC2template.xlsm", _
Password:="YourPassword"
End Sub
Edit:
I was looking it up, but it seems that Microsoft didn't provide a direct way to do it. Maybe because they thought that it's not practical to lock a template with a password.
One possible solution that pops to my mind is to create a copy of the
template and then opening it.
edited Mar 21 at 18:02
answered Mar 20 at 10:02
LouisLouis
30329
30329
No, this opens the template. I want a new workbook based on a template.
– Anton Lahti
Mar 20 at 10:08
2
I was looking it up, but it seems that Microsoft didn't provide a direct way to do it. Maybe because they thought that it's not practical to lock a template with a password. One possible solution that pops to my mind is to create a copy of the template and then opening it.
– Louis
Mar 20 at 10:53
Can you accept my answer, since you used my solution to solve the issue? Thank you.
– Louis
Mar 21 at 18:04
add a comment |
No, this opens the template. I want a new workbook based on a template.
– Anton Lahti
Mar 20 at 10:08
2
I was looking it up, but it seems that Microsoft didn't provide a direct way to do it. Maybe because they thought that it's not practical to lock a template with a password. One possible solution that pops to my mind is to create a copy of the template and then opening it.
– Louis
Mar 20 at 10:53
Can you accept my answer, since you used my solution to solve the issue? Thank you.
– Louis
Mar 21 at 18:04
No, this opens the template. I want a new workbook based on a template.
– Anton Lahti
Mar 20 at 10:08
No, this opens the template. I want a new workbook based on a template.
– Anton Lahti
Mar 20 at 10:08
2
2
I was looking it up, but it seems that Microsoft didn't provide a direct way to do it. Maybe because they thought that it's not practical to lock a template with a password. One possible solution that pops to my mind is to create a copy of the template and then opening it.
– Louis
Mar 20 at 10:53
I was looking it up, but it seems that Microsoft didn't provide a direct way to do it. Maybe because they thought that it's not practical to lock a template with a password. One possible solution that pops to my mind is to create a copy of the template and then opening it.
– Louis
Mar 20 at 10:53
Can you accept my answer, since you used my solution to solve the issue? Thank you.
– Louis
Mar 21 at 18:04
Can you accept my answer, since you used my solution to solve the issue? Thank you.
– Louis
Mar 21 at 18:04
add a comment |
No, there doesn't seem to be any way to do this.
What I ended up doing instead is copying the template to a temporary file, Opening with the password.
Then I made sure that the temporary file was deleted after I was done with it.
add a comment |
No, there doesn't seem to be any way to do this.
What I ended up doing instead is copying the template to a temporary file, Opening with the password.
Then I made sure that the temporary file was deleted after I was done with it.
add a comment |
No, there doesn't seem to be any way to do this.
What I ended up doing instead is copying the template to a temporary file, Opening with the password.
Then I made sure that the temporary file was deleted after I was done with it.
No, there doesn't seem to be any way to do this.
What I ended up doing instead is copying the template to a temporary file, Opening with the password.
Then I made sure that the temporary file was deleted after I was done with it.
answered Mar 21 at 8:59
Anton LahtiAnton Lahti
606
606
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55257597%2fis-it-possible-to-add-a-new-workbook-based-on-a-locked-template%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown