I'm sure this is a very basic question that has a very basic answer but so far I can't make my Excel macro work.
I am trying to open an Excel workbook and input the optional password parameter. However, whenever I do this, I get the error Compile error expected: Named Parameter.
This is my current code
Sub password_opening_test() Workbooks.Open Filename:="E:\password protecting macrotest.xlsx",,,,Password:="test" Range("G7").Select ActiveCell.FormulaR1C1 = "hello" ActiveWorkbook.Save ActiveWindow.Close End Sub I've also tried it by adding square brakets in between the commas but I still recieve the error (which is highlighted by the first comma).
Thanks very much for reading
Workbooks.Open Filename:="E:\password protecting macrotest.xlsx", Password:="test"As long as you specify which argument you are passing (i.e. -Password:=) the extra commas for the other arguments are not necessary.