GRCNC
10-31-2016, 10:32 AM
Hi -
I'm relatively new to Word VBA. Helping a co-worker w/ a project. She has several documents that are locked for editing. When I open the file(s), they are definitely locked for editing.
I have a macro that opens up several of the files (these files are stored on SharePoint) and copies them all into 1 new file. Everything is working as I would like EXCEPT when I use my newly created file (with the 5-7 locked documents combined), all of the files are now editable. I can delete anything and everything - which is not what we want.
My code is relatively long, but here is what I'm using to copy over the locked files:
Dim docProposal As String
docProposal = ActiveDocument.Name
Dim strPath As String
Dim oRng As Range
Documents.Add Template:="Normal", NewTemplate:=False, DocumentType:=0
'Opens the 1st file and inserts the entire document at the current selection
Selection.InsertFile FileName:=strPath & "HEN%20File%20Creator/File%20Intro.docx"
Selection.InsertParagraphAfter
Selection.InsertBreak Type:=wdSectionBreakNextPage
Selection.Collapse direction:=wdCollapseEnd
Wondering if there should be anything else added to maintain the 'locked' status?
Thanks,
GRC
I'm relatively new to Word VBA. Helping a co-worker w/ a project. She has several documents that are locked for editing. When I open the file(s), they are definitely locked for editing.
I have a macro that opens up several of the files (these files are stored on SharePoint) and copies them all into 1 new file. Everything is working as I would like EXCEPT when I use my newly created file (with the 5-7 locked documents combined), all of the files are now editable. I can delete anything and everything - which is not what we want.
My code is relatively long, but here is what I'm using to copy over the locked files:
Dim docProposal As String
docProposal = ActiveDocument.Name
Dim strPath As String
Dim oRng As Range
Documents.Add Template:="Normal", NewTemplate:=False, DocumentType:=0
'Opens the 1st file and inserts the entire document at the current selection
Selection.InsertFile FileName:=strPath & "HEN%20File%20Creator/File%20Intro.docx"
Selection.InsertParagraphAfter
Selection.InsertBreak Type:=wdSectionBreakNextPage
Selection.Collapse direction:=wdCollapseEnd
Wondering if there should be anything else added to maintain the 'locked' status?
Thanks,
GRC