Macro .Path on Win 7 - Statistica Visual Basic - Statistica - Dell Community

Macro .Path on Win 7

Macro .Path on Win 7

This question is not answered

Hello,

I have a macro calling:

strMyName = Macros("MyMacro.svb").Path

Since I migrated from Vista to Win7, this call generate an Exception 80004005

This not the case, when I change the user Folder settings to 'display' the file extension.

Unfortunately, my users works on standard configuration, and this workaround can't be used.

Do you have an other idea of workaround? Is it a bug in the standard libraries?

(using Statistica version 10)


Thank you,

 

 

 

 

 

 

All Replies
  • Hi, efr,

    Actually, the bug is that your method of referencing the macro works at all.  The Macros collection uses the .Item property to refer to individual macros within this collection, and the .Item property is an integer value.  Here’s a workaround that should permit you to extract the path property from the desired macro, regardless of whether or not the user has elected to display file extensions:

    Sub Main

                   Dim strMyName As String

                   Const MACRO_NAME As String = " MyMacro"

                   Dim q As Long

                   For q = 1 To Macros.Count

                                  If InStr(1, Macros.Item(q).Name, MACRO_NAME) > 0 Then strMyName = Macros.Item(q).Path

                   Next q

    End Sub

    I do hope that you find this solution satisfactory.