Sub Upgrade()
Dim VBComp As VBIDE.VBComponent
Dim Sfx As String
p = "Q:\CS Management Reports\Reports
Setup\Administrator Files"
f = "Administrator Setup.xls"
s = "Reports Setup"
a = "F6"
'MsgBox GetValue(p, f, s, a)
If GetValue(p, f, s, a) = 1 Then
'Code below if code does NOT equal 1
If MsgBox("An upgrade is available. Would you like to
upgrade now?", vbYesNo) = vbNo Then
With CreateObject("Wscript.Shell")
.Popup ("Program Setup Up-To-Date. Now quitting
application...") _
, 1, "Ops Reports Setup", 64
End With
Exit Sub
Else
'Code below if code DOES equal 1
'EXPORTING ALL MODULES IN A WORKBOOK
For Each VBComp In Workbooks
("ImportData.xls").VBProject.VBComponents
Select Case VBComp.Type
Case vbext_ct_ClassModule, vbext_ct_Document
Sfx = ".cls"
Case vbext_ct_MSForm
Sfx = ".frm"
Case vbext_ct_StdModule
Sfx = ".bas"
Case Else
Sfx = ""
End Select
If Sfx <> "" Then
VBComp.Export _
Filename:="Q:\CS Management Reports\Reports
Setup\Administrator Files\Exported Modules" & "\" &
VBComp.Name & ".txt"
'Filename:="Q:\CS Management Reports\Reports
Setup\Administrator Files\Exported Modules" & "\" &
VBComp.Name & Sfx
'Filename:=ActiveWorkbook.path & "\" &
VBComp.Name & Sfx
End If
Next VBComp
'Shows Program Update message box
With CreateObject("Wscript.Shell")
.Popup ("Program Update. Now quitting
application...") _
, 1, "Ops Reports Setup", 64
End With
End If
End If
End Sub