+ Reply to Thread
Results 1 to 5 of 5

Password protect macro script

  1. #1
    Forum Contributor
    Join Date
    02-24-2010
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    195

    Post Password protect macro script

    Hey folks,

    I've used a similar script to the one below in a previous project. This time I amlooking at adding this piece to a fromatting macro.

    I've got a 'Compile Erroe: Expected expression' on the ':='. Any ideas why?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Password protect macro script

    FileFormat is not a method of the ActiveWindow object.

    What is this line of code trying to achieve? I suspect you might want to be using ActiveWorkbook.Save.
    Martin

  3. #3
    Forum Contributor
    Join Date
    02-24-2010
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    195

    Re: Password protect macro script

    I tried useing the below script within the 'Save file' part of the production script but I get an 'Compile Error: Else without If' and I cant see why.

    Any idea?

    Please Login or Register  to view this content.

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Password protect macro script

    You don't need the Else or End If statements as you have the next statement immediately after the 'Then'

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Password protect macro script

    I think you need to be using Saveas or SaveCopyAs
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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