Spikenaylor
Board Regular
- Joined
- Apr 14, 2013
- Messages
- 116
- Office Version
- 365
- Platform
- Windows
In workbook 1
Functions - module
Public Function Sheetpasswrd()
Sheetpasswrd = "1234"
End Function
VBA Project locked for viewing etc
In workbook 2
in a vba module
I am moving the data from workbook 2 into workbook 1 but I need to unlock the workbook 1
In workbook 2, i can within a cell retrieve the password
In VBA i am struggling to retrieve the password from the function in workbook 1
I have tried various solutions from the net but unsuccesfully
Workbook 2 module
dim wbk as Workbook, password as string
set wbk = Workbooks.open(Filename:= "Path to workbook 1)
wbk. activate
password = Application.run(wkb!Functions, Sheetpasswrd)
wbk.unprotect password:= password
I just keep coming up with errors
Can anyone point out my errors
Functions - module
Public Function Sheetpasswrd()
Sheetpasswrd = "1234"
End Function
VBA Project locked for viewing etc
In workbook 2
in a vba module
I am moving the data from workbook 2 into workbook 1 but I need to unlock the workbook 1
In workbook 2, i can within a cell retrieve the password
In VBA i am struggling to retrieve the password from the function in workbook 1
I have tried various solutions from the net but unsuccesfully
Workbook 2 module
dim wbk as Workbook, password as string
set wbk = Workbooks.open(Filename:= "Path to workbook 1)
wbk. activate
password = Application.run(wkb!Functions, Sheetpasswrd)
wbk.unprotect password:= password
I just keep coming up with errors
Can anyone point out my errors