Mail merge with a password-protected EXCEL file on opening

Chat678 -  
cs_Le Pivert Posted messages 8437 Status Contributor -
Hello,

First of all, I understand that my request is illogical but I was wondering if it was possible to work around the problem.

Let me explain. My Excel file is password-protected upon opening. As a result, when I want to do a mail merge in WORD using this file as the data source, an error message appears. Is there a way to carry out the mail merge in WORD, for example by entering the password listed in EXCEL? Or by another means?

Configuration: Windows / Chrome 96.0.4664.45

2 answers

  1. cs_Le Pivert Posted messages 8437 Status Contributor 730
     
    Hello,

    in VBA to be placed in the Word document.

    Press Alt F11 to access the editor.

    Insert a module and put this code:

     'go to Tools-References and check Microsoft Excel xx.x Object Library' Sub test() Dim appXl As Excel.Application Dim Wb As Excel.Workbook Set appXl = CreateObject("Excel.Application") appXl.Visible = True Set Wb = appXl.Workbooks.Open("C:\Users\LePivert\Documents\Classeur1.xlsx", Password:="1234") 'adapt password and path End Sub 


    --
    @+ Le Pivert
    0
  2. Chat678
     
    Hello,

    I tried making sure to change the file path and the password, but the same message still appears.

    An error occurred: The external table is not in the expected format"

    Do you have any idea about this?

    Thank you for your response!
    0