3 Replies Latest reply: Jul 13, 2016 6:18 PM by Jamel Oueslati RSS

    Defining Variables outside a Sub (marco variable)

    Jamel Oueslati

      Hi all,

       

      Is it possible to define a variable, to be used in sub / macro?

       

      I have a file path hardcoded in a macro, but if I want this to change, I don't really want to search the script for all instances of it.

       

      I know in SAS, SQL etc...I can use a macro variable & state it at the top.  Is this possible with VBScript?

       

      Something like this I want to do:

       

      FilePath = C:\user\document\pictures

       

      Sub

       

      dim fso
      Set fso =CreateObject("Scripting.FilesystemObject")
      fso.CreateTextFile "FilePath\dummy.txt"

      End Sub