Consulting

Results 1 to 3 of 3

Thread: VBScript Fails When I reopen Excel File

  1. #1

    VBScript Fails When I reopen Excel File

    I inserted a VBA function into my Excel file to reverse a string in a cell using:
    Option Explicit
    Public Function ReverseString (Text As String)
    ReverseString = StrReverse (Text)
    End Function

    When I save and close the file then reopen the file the script does not run and I get a NAME? error in the cells. Any Suggestions?

    Matt

  2. #2
    Did you put the function in a normal module?
    Did you enable macros when opening (or maybe security is set to high?)
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  3. #3
    VBAX Regular jamward's Avatar
    Joined
    Feb 2008
    Location
    Grand Rapids, MI USA
    Posts
    26
    Location
    hope this helps.

    When you use the Option Explicit statement, you must explicitly declare all variables using the Dim, Private, Public, or ReDim statements. If you attempt to use an undeclared variable name, an error occurs.

    -Jim
    Grand Rapids, MI


Posting Permissions

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