Re: $$Excel-Macros$$ control the macro commands in excel vba

2016-02-26 Thread Paul Schreiner
OK... I think we need to clarify some things.The VBA project doesn't have a 
different datelastmodified than the excel Workbook.And the datelastmodified 
doesn't get changed until you SAVE the workbook.
So...In your scenario.Do you have two files? a "Master" file and a "user" file 
and you wish to compare the datelastmodified for the two of them?
If THAT assumption is correct, you can create a Workbook_Open event macro in 
the ThisWorkbook module.Something like:
Option Explicit
Private Sub Workbook_Open()
    Dim f, fso
    Dim fMaster, fUser
    Dim dMaster, dUser
    
    fMaster = "C:\temp\VBA\Test_Master.xlsb"
    fUser = ThisWorkbook.FullName
    
    Set fso = CreateObject("Scripting.FileSystemObject")
    ' Check to see if this IS the "Master" workbook
    If (fUser = fMaster) Then Exit Sub    ' Determine Date of current file
    Set f = fso.getfile(fUser)
    dUser = f.datelastmodified
    
    ' Determine Date of "MASTER" file
    If (fso.fileexists(fMaster)) Then
    Set f = fso.getfile(fMaster)
    dMaster = f.datelastmodified
    Else
    MsgBox "Could not locate file:" & Chr(13) & fMaster
    Exit Sub
    End If
    
    If (DateDiff("s", dMaster, dUser) <> 0) Then
    MsgBox "Not Latest Released Version"
    Else
    'Call macros here
    MsgBox "Running Macros"
    End If
End Sub



Paul-
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
- 

On Thursday, February 25, 2016 9:52 PM, Kat  wrote:
 
 

 Hi guys,

I have 7 subs in my module. I would like to control that if the 
datelastmodified of excel vba is same as datelastmodified of the master file, 
then don't run the 7 subs. If the datelastmodified of both are not same, then 
run all the subs. What should I put in 'ThisWorkbook' and how do I organize my 
sub? Can anyone help?

Thanks in advance.


Cheers
-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel
 
FORUM RULES
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.
 
NOTE : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at https://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.


 
  

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at https://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.


$$Excel-Macros$$ control the macro commands in excel vba

2016-02-25 Thread Kat
Hi guys,

I have 7 subs in my module. I would like to control that if the 
datelastmodified of excel vba is same as datelastmodified of the master 
file, then don't run the 7 subs. If the datelastmodified of both are not 
same, then run all the subs. What should I put in 'ThisWorkbook' and how do 
I organize my sub? Can anyone help?

Thanks in advance.


Cheers

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at https://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.