+ Reply to Thread
Results 1 to 18 of 18

ActiveWorkbook Property Errors When Openend from Email

  1. #1
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    ActiveWorkbook Property Errors When Openend from Email

    Hello all,

    The following code works correct.
    It determines if the workbook is stored on an "authorized" location.
    the authorized file paths are stored in range G4:G20 on sheet "PROTECTION"

    It only errors when the file is opened from en email attachment.
    And all I try, I can't get it to work.
    The problem seems to be the "Active..." properties.
    Does any of you recognize the problem?

    Please Login or Register  to view this content.
    I also tried. (but without success"
    Please Login or Register  to view this content.
    Last edited by Jonathan78; 04-10-2013 at 04:23 AM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: ActiveWorkbook Property Errors When Openend from Email

    If the file has been opened from an attachment without saving then it might not have a path.

    If it does it's probably to a temporary folder of some kind.

    By the way, if you want to refer to the workbook the code is in use ThisWorkbook instead of ActiveWorkbook.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: ActiveWorkbook Property Errors When Openend from Email

    Quote Originally Posted by Norie View Post
    If the file has been opened from an attachment without saving then it might not have a path.

    If it does it's probably to a temporary folder of some kind.

    By the way, if you want to refer to the workbook the code is in use ThisWorkbook instead of ActiveWorkbook.
    ThisWorkbook did the trick.
    Thank you Norie!

  4. #4
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: ActiveWorkbook Property Errors When Openend from Email

    Hello,

    I got the same problem with "ActiveWindow"
    Is there an alternative for this?

    (Again, the error only occurs when opened from email)

    Please Login or Register  to view this content.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644
    Where is all this code located?

  6. #6
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: ActiveWorkbook Property Errors When Openend from Email

    Hello Norie,

    It's located in the workbook_Open.
    This is the full code

    Please Login or Register  to view this content.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644
    Probably a stupid question, but do you need all of the code?

  8. #8
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: ActiveWorkbook Property Errors When Openend from Email

    hahaha, I think I do.
    Do you know a better way?

    I'm not that experienced yet

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: ActiveWorkbook Property Errors When Openend from Email

    Jonathan

    Are you just trying to open these files?

  10. #10
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: ActiveWorkbook Property Errors When Openend from Email

    I'm trying to "secure" it.
    It can only be opened on computers and folders that are mentioned in sheet "PROTECTION"
    This all works properly but gives an error when opened from an email.
    After it has been saved on a computer it works properly again.

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: ActiveWorkbook Property Errors When Openend from Email

    Jonathan

    I'm a little confused, is this your code and you are sending out the workbook(s)?

    Or are you receiving the workbook(s) and this isn't your code?

  12. #12
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: ActiveWorkbook Property Errors When Openend from Email

    This is my code Norie,
    The file is being used by my colloquies but don't want them to make copies and sent them to home.
    If they sent it by mail to their homes, I want it to be closed upon trying to open it.

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: ActiveWorkbook Property Errors When Openend from Email

    Jonathan

    If it's your code why not just remove the parts that don't work?

    By the way, this code could be easily be bypassed.

  14. #14
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: ActiveWorkbook Property Errors When Openend from Email

    Norie,

    If I remove the part that doesn't work.
    ActiveWindow.DisplayWorkbookTabs = False
    It will display the workbooktabs (I want them to be hidden)

    btw How can it bypassed? (Macro's are password protected, and all menu's "sheettabs" are hidden)

  15. #15
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: ActiveWorkbook Property Errors When Openend from Email

    The user could disable macros, or hold downd SHIFT when the workbook is opened.

    Both would stop the code running.

    Having passwords might help but Excel really isn't a secure environment.

    What is it you want to prevent the user copying?

  16. #16
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: ActiveWorkbook Property Errors When Openend from Email

    The workbook doesn't work with the macro's disabled.
    I know it isn't a secure environment but enough for the normal user.

    I want the user to see only the "start" sheet and don't want them to see the macro's and other sheets

  17. #17
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: ActiveWorkbook Property Errors When Openend from Email

    They can still open the workbook and then copy it.

    If you just want the user to see one sheet, why are you hiding all worksheet tabs?

    This will hide all sheets apart from 'Start'.
    Please Login or Register  to view this content.

  18. #18
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: ActiveWorkbook Property Errors When Openend from Email

    Thanks Norie,
    I will use your solution.
    btw. Do you know a better way to secure my workbook?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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