Hi there,

A while ago I created a very simple excel worksheet that opened up another more complicated excel workbook (master document) un-protected the document and "un-hid" specific sheets and then allowed the user to copy inputted data over to the other workbook. It would then allow the user at the touch of a button to re-protect the document and hide all the specific sheets etc.

Basically it allowed members of my team to input data into a master document without the risk of them screwing the master document up. Shhh don't tell them I said that!

The macros behind all that is below:

Sub START_INJECTOR()
'
' START_INJECTOR Macro opens and unprotects claim

'
 Dim wb As Workbook
    Application.EnableEvents = False
    Set wb = Workbooks.Open("L:\e-Claim Forms\Claim_v3.xls")
  
        
    Windows("Claim_v3.xls").Activate
    ActiveWorkbook.Unprotect Password:="******"
    Sheets("Project Information").Visible = True
    
    Windows("Claim injector.xls").Activate
End Sub
Sub INJECT_PROJ()
'
' INJECT Macro injects project details into claim

'
    Range("C10:C13").Copy
    Windows("Claim_v3.xls").Activate
    Sheets("Project Information").Select
    Range("N7:N10").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
        Windows("Claim injector.xls").Activate
End Sub
Sub INJECT_MEASURE()

' INJECT MEASURE injects measure details into claim

Range("G13").Copy
    Windows("Claim_V3.xls").Activate
    Sheets("Project Information").Select
    Range("K20").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
Windows("Claim injector.xls").Activate

End Sub
Sub INJECT_CAP()
'
' INJECT Macro Injects Capital details into claim

'
    Range("B17:C31").Copy
    Windows("Claim_v3.xls").Activate
    Sheets("Project Information").Select
    Range("M14:N28").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Windows("Claim injector.xls").Activate
End Sub
Sub INJECT_REV()
'
' INJECT Macro Injects Revenue details into claim



'
    Range("B34:C48").Copy
    Windows("Claim_v3.xls").Activate
    Sheets("Project Information").Select
    Range("M31:N45").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Windows("Claim injector.xls").Activate
End Sub
Sub FINISH_INJECT()
'
' FINISH_INJECT Macro reprotects claim


'

    Windows("Claim_v3.xls").Activate
    
    ActiveWindow.SelectedSheets.Visible = False
    Application.CutCopyMode = False
    
    ActiveWorkbook.Protect Password:="******", Structure:=True, Windows:=False
    
    Exit Sub
    
    Application.EnableEvents = True
   
    
End Sub
Now all that works fine....up until now! The above is all well and good as the document I am copying data into is a constant "Claim_v3.xls" and in a constant location. I now need to be able to select the document I wish to "Inject" into as a variable.

So....the "START INJECTOR" Macro needs to allow me to Open up any workbook using Windows explorer and browse and select the specific file. The password of the file to be opened will be constant as will the cell ranges that are being copied from and to. Just the name will change.

I will need the following code somewhere in the "START INJECTOR" macro:

Sub RetrieveFileName()
Dim sFileName As String

	'Show the open dialog and pass the selected _
	file name to the String variable "sFileName"
	
	sFileName = Application.GetOpenFilename
	'They have cancelled.
	If sFileName = "False" Then Exit Sub
	MsgBox sFileName
End Sub
But I don't know where to put it for a start and then how do make every referal in my current code to "Claim_v3.xls" actually refer to the workbook that has been opened.

Hopefully that makes sense. Thankyou in advance.

Regards
Geff