Solved: VBA - from open doc 1, open doc 2, close doc 1
I will be opening and editing numerous word documents. To ease the user in following an 'order' to the documents, I would like to have a command button at the end that saves document 1, opens document 2, and closes document 1.
They will then continue on document 2 and follow a similar path until the final doc (another story).
Below is the vba I have so far. I can open doc 2, but in closing doc 1 I get a File In Use pop up that says doc 1 is locked for editing by "owner"
Do you want to: Open a Read Only copy, Create a local copy and merge your changes later, Receive notification when the original copy is available.
I'm guessing the error lies in my close statement.
Thanks for the help.
[VBA]' FileSave
' Saves the active document or template
Dim UserSaveDialog As Dialog
Set UserSaveDialog = Dialogs(wdDialogFileSaveAs)
With UserSaveDialog
.Name = saveString
UserSaveDialog.Execute
End With
'Open next document
npathString = xlApp.Workbooks("MasterIndex.xls").Sheets("Doc_Index").Range("B3")
ndotString = xlApp.Workbooks("MasterIndex.xls").Sheets("Doc_Index").Range("D3")
nopenString = npathString & ndotString
'Open Word Instance
Set wdApp = CreateObject("Word.Application")
wdApp.Visible = True
'Open Template as Document
wdApp.Documents.Add Template:=(nopenString)
wdApp.Activate
'Close document wdApp.Documents.Open(saveString).Close
wdApp.Documents.Open(saveString).Close
End Sub
[/VBA]