Jump to content

Recommended Posts

Posted

 

 

1706081041da47c9620142f3c3.png

$lastSummaryXls = ObjGet(@ScriptDir & "\" & 07Summary.xls)
        If @error Then MsgBox(16, 1, "Error")
        With $lastSummaryXls.Worksheets("Summary")
                $EmpList = .cells(1, 1).resize(.UsedRange.Rows.Count , .UsedRange.Columns.Count).value
                $EmpList = $lastSummaryXls.parent.application.transpose($EmpList) 
                ;_ArrayDisplay($EmpList)
                .parent.close(False)
        EndWith

The above code has been tested if the open excel file is protected, such as the file is downloaded from the network, or U disk, or above the office version of Office opened 97 office xls file, excel default security options will prompt the excel file Is protected, and can not be modified by default (unless all protection is turned off in the office's options - trust settings).
If you are using excel to manually open this file, you can click excel above the protected view - edit anyway to lift the protection (only need to set once, office will remember that this file is trusted). Again use Au3 can read excel to get the data.

Please help me to see how read-only way to open the protection of the excel file.Thank  you!!!

07Summary.xls

Posted

The problem does not seem to be caused by the trust settings but by Excel having a problem reading and validating the structure of the file.
https://support.office.com/en-us/article/What-is-Protected-View-d6f09ac7-e6b9-4495-8e43-2bbcdbcb6653?CTT=1&CorrelationId=dbc4e198-ee91-49ae-992a-e342938cd2e6&ui=en-US&rs=en-US&ad=US&ocmsassetID=HA010355931

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted (edited)
On 2017/9/28 at 3:25 AM, water said:

Hi

How to use au3 to remove file protection?

Does the test use the read-only parameter to open the file failed, can the other way to try to read the data?

Thank you!

Edited by ioripalm
Posted

The site I pointed you to, describes that there seems to be a problem witht he structure of your Excel file. So you can't expect valid results by just removing the proteced view.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

I think it would depend on the real reason the file opens in protected mode. Sometimes this is resolved by saving the file as xlsx.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...