0

I have an xlsm file that I need to insert data but my problem is that the xlsm in protected. I use the oWorkbook.Protect(,,.F.) to unprotect but the function is not working. I s there any way to unprotect the file using the foxpro?

oExcel = CreateObject("Excel.Application")
**checking if the excel installed into the computer
if vartype(oExcel) != "O"
    MESSAGEBOX("could not instantiate Excel object.")
  return .F.
ENDIF

oExcel.DisplayAlerts = .F.
oExcel.visible=.T.
**opening the data File
oWorkbook = oExcel.Application.workbooks.open(SYS(5)+SYS(2003)+"\WebADI Template\WebADI.xlsm")
**unprotect the workbook
oWorkbook.Protect(,,.F.)
Vic
  • 457
  • 1
  • 6
  • 23
  • Can you unprotect it in Excel? Is it protected with a password? – Alan B Mar 02 '21 at 10:08
  • @AlanB Yes i can unprotect the file. I already save the xlsm in unprotect but when reopen the file will be protected. I think there are mechanizing in the macro when the will open it automatically protect the file. – Vic Mar 03 '21 at 00:18

0 Answers0