colinmitton
Technical User
I have set up a macro to auto run when a word 2010 template is opened, it will then ask for another word document to be inserted in to that document. Once done it will them open a different template as a separate document.
This will then leave the two correct documents on screen, I'm happy with this but I need to change one detail. The first document thats created (which has the inserted file in) goes to the 'back' the second file is on front. I really need it to be the other way round! I dont want them to auto save anywhere as it will confuse my poor users when they do to save!
Is there a way of dynamically getting control of the first document?
This will then leave the two correct documents on screen, I'm happy with this but I need to change one detail. The first document thats created (which has the inserted file in) goes to the 'back' the second file is on front. I really need it to be the other way round! I dont want them to auto save anywhere as it will confuse my poor users when they do to save!
Is there a way of dynamically getting control of the first document?
Code:
Sub AutoNew()
Application.Run MacroName:="textinput"
End Sub
Sub textinput()
With Selection.Find
.ClearFormatting
.Text = "***"
.Replacement.Text = ""
.Forward = True
.Execute
End With
Dim defpath As String
defpath = Options.DefaultFilePath(wdDocumentsPath)
Options.DefaultFilePath(wdDocumentsPath) = "C:\2010\Rule2 Letters"
With Dialogs(wdDialogInsertFile)
.Name = "*.docx"
.Show
End With
Options.DefaultFilePath(wdDocumentsPath) = defpath
Documents.Add Template:="C:\2010\Word\Forms - Files\Standard Terms of Business.dotx", NewTemplate:= _
False, DocumentType:=0
End Sub