Declare File Path & Today's Current Date As Constants

  • Hello,


    My first ever post in Ozgrid. I hope I meet all the rules in my title.....


    I have a VBA module in Excel with several procedures which are basically used to collect data from several sources. Some variables are the same for all procedures, so I thought I woul tidy up my code a litle and avoid repeatadly declaring these variable for each procedure by declaring them at the beginning of the module under as Constants under "declarations".


    That works fine for Strings and integers, but not for workbook.path or Todays Date. Is that because the date and workbook.path by nature are not constants, so can't be declared as such. Throughout the module their values do not change so i am somewhat confused. Do I have to re-declare these values for each sub-procedure?


    I just noticed the typo in my thread title, which I can't edit. Sorry


    Thanks in advance. I love this forum!!

  • Re: Vba Ddeclaring File.path Ans Todays Date As Constants


    Quote from Sir Eddy

    Do I have to re-declare these values for each sub-procedure?


    No, just use a global variable.

    Quote from Sir Eddy

    I just noticed the typo in my thread title, which I can't edit.


    Sure you can.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!