+ Reply to Thread
Results 1 to 8 of 8

Password setting and Error 424

  1. #1
    Registered User
    Join Date
    09-20-2013
    Location
    Hong Kong
    MS-Off Ver
    Excel 2013
    Posts
    88

    Password setting and Error 424

    Dear all,

    I have 2 documents. The vba below is used to copy the contents of table in doc1 and paste it in table of doc2 and then set password for doc 2.

    I got error code 424 object required at this line:

    Please Login or Register  to view this content.
    And password of the document 2 could not be set.

    Please Login or Register  to view this content.
    Full code:
    Please Login or Register  to view this content.
    Could anyone advise? Thank you!

  2. #2
    Forum Expert ByteMarks's Avatar
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    3,175

    Re: Password setting and Error 424

    I think you might be confusing applications and documents.

    You've got two applications, wdApp1 and wdApp2, whereas you probably really only need one instance of Word.
    If Word is already running then these would likely both point to the same instance of Word anyway.
    Please Login or Register  to view this content.
    You have two variables for the documents wdDoc1 and wdDoc2.
    However, if Word isn't already running then, instead of being documents these are actually two separate application instances.
    Please Login or Register  to view this content.

    Maybe something along these lines

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-20-2013
    Location
    Hong Kong
    MS-Off Ver
    Excel 2013
    Posts
    88

    Re: Password setting and Error 424

    Dear Bytemarks,
    It worked perfectly. Thank you so much for your advice! Really appreciate your help. Thank you!

  4. #4
    Registered User
    Join Date
    09-20-2013
    Location
    Hong Kong
    MS-Off Ver
    Excel 2013
    Posts
    88

    Re: Password setting and Error 424

    However, password could not be set still.

  5. #5
    Registered User
    Join Date
    09-20-2013
    Location
    Hong Kong
    MS-Off Ver
    Excel 2013
    Posts
    88

    Re: Password setting and Error 424

    Dear all,

    I still could not figure out the password setting part, the revised code (running from excel) after ByteMarks remarks above is as follows, the code could be run smoothly to copy contents from plan.doc in lesson plan folder to report.doc (attached here) in the same folder as the macro without setting password.

    Any advice is appreciated.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Expert ByteMarks's Avatar
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    3,175

    Re: Password setting and Error 424

    Hi,


    Looks like the 123 in Password:=”123” has smart quotes rather than "proper" quotes. Maybe that's the reason?

  7. #7
    Registered User
    Join Date
    09-20-2013
    Location
    Hong Kong
    MS-Off Ver
    Excel 2013
    Posts
    88

    Re: Password setting and Error 424

    Hi ByteMarks!!!!

    I got it. The existing password will only protect the document setting password for Tracking changes (revisions) . I have to change the code=
    Please Login or Register  to view this content.
    . In this way, the whole document would be protected and need "333" to open the document which is what i wanted.

    Thank you so much for your help!!!!!

  8. #8
    Forum Expert ByteMarks's Avatar
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    3,175

    Re: Password setting and Error 424

    That's great. You're very welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Setting a password
    By Gstan1949 in forum Excel General
    Replies: 4
    Last Post: 03-26-2017, 03:56 AM
  2. setting password question
    By adamheon in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-16-2017, 05:13 PM
  3. Runtime Error 1004 when Setting Setting Series Values
    By tonymctigue in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 04-09-2010, 10:05 AM
  4. Setting password to pdf through VB Macro
    By Mrunalini in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-23-2008, 05:10 AM
  5. Password setting syntax
    By Dave in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-09-2006, 01:15 AM
  6. Allow disabling of password, but no setting of password
    By KobusD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-07-2005, 03:05 PM
  7. Password Setting
    By VBALearner in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-08-2005, 11:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1