Excel VBA to copy cells from password protected file into another file
Hello,
I have the following code:
Sub Button1_Click()
Range("E1:E12").Value = "='C:\Users\zzz\Desktop\New folder\[source.xlsx]Sheet1'!D1:D12"
Range("G1").Value = "='C:\Users\zzz\Desktop\New folder\[source.xlsx]Sheet1'!G1"
Sheets("Sheet1").Range("H1").Value = Format(Now, "dd-mmm-yy hh-mm-ss")
End Sub
it copies cells D1:D12 from source.xlsx file into E1:E12 cells in my main file as well as cell G1 respectively and puts a time stamp in cell H1.
Does anyone know how the code should look like if the source.xslx is password protected??? I do not want to be prompted for a password all the time I use the macro... :dunno
Many thanks in advance.