+ Reply to Thread
Results 1 to 7 of 7

after closing and opening the worksheet the vba code not working

  1. #1
    Registered User
    Join Date
    06-21-2008
    Posts
    10

    after closing and opening the worksheet the vba code not working

    Hi
    im working on excel 2007
    i write the following code

    Please Login or Register  to view this content.
    and when i click save it givers me message inform that in order to save this feature you should save in macro-enabled file and i save it as macro enabled work sheet it gives me message says"privacy warning this document contains macro or web content that may include personal information that cannot be removed by the doument inspector" and i click yes

    and test it and it works fine. then i close the work sheet and open it again and try to test that code i find that it doesn't work !!! although the code still found !!

    any idea what wrong?

    thanks in advance.
    Last edited by VBA Noob; 06-21-2008 at 01:57 AM.

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

    Please Login or Register  to view this content.
    I wouldb't use Sheets(1) though because if the tabs are re-arranged then it will refer to a different workbook. If the code refers to the sheet that holds the code then use
    Please Login or Register  to view this content.
    or if not use

    Please Login or Register  to view this content.
    Hope that helps.

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

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    06-21-2008
    Posts
    10
    thanks for reply

    i try all your methodsbut don't work !!
    i attach the excel file that contain the code
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    06-21-2008
    Posts
    8
    It seems that you are facing macro security problems. Go Office Button->Excel Options->Trust Center-> Trust Center Setting.

    and there you can set your macro security options. (you should reduce the default security level).

    OR... when you open your workbook look at the line just above your formula bar. you will see a security warning. follow it and enable your macro.

  5. #5
    Registered User
    Join Date
    06-21-2008
    Posts
    10
    yea it works

    it was "enable the macro vba setting"
    thanks.

  6. #6
    Registered User
    Join Date
    06-21-2008
    Posts
    10
    one more question
    if i enter any special character like "\'{""|" it gives error message for debugging
    how to avoid this
    like giving a message says "please enter correct string"

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Try
    Please Login or Register  to view this content.

+ 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