Sub GetDataFromTxt()
Dim PathX
Dim ObjName, EtichettaStanza, ColoreTipoStanza, ColoreStatoStanza, NumeroStanza, TipoStanza, NumeroPosti, StatoStanza, StanzaFemmine
Dim Arr_ColoreStatoStanza
Dim TotalePosti
Dim PostiOccupati
Dim PersonaleMaschile
Dim PersonaleFemminile
Dim StanzeGaslini
Dim NumeriStanzeGaslini
Dim StanzeInagibili
Dim PostiInagibili
Dim NumeriStanzeInagibili
Dim Statistiche
Dim LedStanza
Dim X As Integer
'***************************
'CASERMA 2° PIANO LATO SUD**
'***************************
X = 4 'Contatore per gli oggetti nel do while
ActivePresentation.Slides(5).Select 'Seleziono la slide su cui lavorare
PathX = ActivePresentation.Path
Open PathX & "\2PianoCaserma.txt" For Input As #1
Do While Not EOF(1)
Input #1, NumeroStanza
Input #1, TipoStanza
Input #1, StatoStanza
Input #1, NumeroPosti
Input #1, StanzaFemmine
Input #1, ColoreTipoStanza
Input #1, ColoreStatoStanza
Input #1, ObjName
Input #1, EtichettaStanza
'Input #1, Statistiche
'Input #1, TotalePosti
'Input #1, PostiOccupati
'Input #1, PersonaleMaschile
'Input #1, PersonaleFemminile
'Input #1, StanzeGaslini
'Input #1, StanzeInagibili
If NumeroStanza = 782 Then
a = 1
End If
If Mid(ColoreStatoStanza, 1, 1) = "," Then
ColoreStatoStanza = Mid(ColoreStatoStanza, 2)
End If
'Assegno i nomi agli oggetti
ActivePresentation.Slides(5).Shapes(X).Name = EtichettaStanza 'Assegno il nome all'ovale (Shape 3 nella slide)
ActivePresentation.Slides(5).Shapes(X).Select
ActivePresentation.Slides(5).Shapes(X + 1).Name = ObjName
ActivePresentation.Slides(5).Shapes(X + 1).Select
ActivePresentation.Slides(5).Shapes(EtichettaStanza).Fill.ForeColor.RGB = ColoreTipoStanza 'RGB(Red:=230, Green:=126, Blue:=34)
ActivePresentation.Slides(5).Shapes(EtichettaStanza).Fill.BackColor.RGB = RGB(Red:=105, Green:=143, Blue:=38)
ActivePresentation.Slides(5).Shapes(EtichettaStanza).Fill.TwoColorGradient Style:=msoGradientHorizontal, Variant:=2
'ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = RGB(Red:=15, Green:=143, Blue:=38)
ActivePresentation.Slides(5).Shapes(ObjName).TextFrame.TextRange.Text = NumeroStanza
ActivePresentation.Slides(5).Shapes(ObjName).TextFrame.MarginBottom = 50
ActivePresentation.Slides(5).Shapes(ObjName).TextFrame.MarginLeft = 10
If NumeroPosti = 1 Then
LedStanza = "LED" & NumeroStanza & "_1"
ActivePresentation.Slides(5).Shapes(X + 3).Name = LedStanza
ActivePresentation.Slides(5).Shapes(X + 3).Select
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = ColoreStatoStanza 'RGB(Red:=15, Green:=143, Blue:=38)
End If
If NumeroPosti = 2 Then
If StatoStanza = "I" Then
LedStanza = "LED" & NumeroStanza & "_1"
ActivePresentation.Slides(5).Shapes(X + 3).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = Arr_ColoreStatoStanza(0) 'RGB(Red:=15, Green:=143, Blue:=38)
LedStanza = "LED" & NumeroStanza & "_2"
ActivePresentation.Slides(5).Shapes(X + 3 + 1).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = Arr_ColoreStatoStanza(1) 'RGB(Red:=15, Green:=143, Blue:=38)
Else
Arr_ColoreStatoStanza = Split(ColoreStatoStanza, ",")
LedStanza = "LED" & NumeroStanza & "_1"
ActivePresentation.Slides(5).Shapes(X + 3).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = Arr_ColoreStatoStanza(0) 'RGB(Red:=15, Green:=143, Blue:=38)
LedStanza = "LED" & NumeroStanza & "_2"
ActivePresentation.Slides(5).Shapes(X + 3 + 1).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = Arr_ColoreStatoStanza(1) 'RGB(Red:=15, Green:=143, Blue:=38)
End If
X = X + 1
End If
If NumeroPosti = 3 Then
If StatoStanza = "I" Then
LedStanza = "LED" & NumeroStanza & "_1"
ActivePresentation.Slides(5).Shapes(X + 3).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = ColoreStatoStanza 'RGB(Red:=15, Green:=143, Blue:=38)
LedStanza = "LED" & NumeroStanza & "_2"
ActivePresentation.Slides(5).Shapes(X + 3 + 1).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = ColoreStatoStanza 'RGB(Red:=15, Green:=143, Blue:=38)
LedStanza = "LED" & NumeroStanza & "_3"
ActivePresentation.Slides(5).Shapes(X + 3 + 2).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = ColoreStatoStanza 'RGB(Red:=15, Green:=143, Blue:=38)
Else
Arr_ColoreStatoStanza = Split(ColoreStatoStanza, ",")
LedStanza = "LED" & NumeroStanza & "_1"
ActivePresentation.Slides(5).Shapes(X + 3).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = Arr_ColoreStatoStanza(0) 'RGB(Red:=15, Green:=143, Blue:=38)
LedStanza = "LED" & NumeroStanza & "_2"
ActivePresentation.Slides(5).Shapes(X + 3 + 1).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = Arr_ColoreStatoStanza(1) 'RGB(Red:=15, Green:=143, Blue:=38)
LedStanza = "LED" & NumeroStanza & "_3"
ActivePresentation.Slides(5).Shapes(X + 3 + 2).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = Arr_ColoreStatoStanza(2) 'RGB(Red:=15, Green:=143, Blue:=38)
End If
X = X + 2
End If
If NumeroPosti = 4 Then
If StatoStanza = "I" Then
LedStanza = "LED" & NumeroStanza & "_1"
ActivePresentation.Slides(5).Shapes(X + 3).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = Arr_ColoreStatoStanza(0) 'RGB(Red:=15, Green:=143, Blue:=38)
LedStanza = "LED" & NumeroStanza & "_2"
ActivePresentation.Slides(5).Shapes(X + 3 + 1).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = Arr_ColoreStatoStanza(1) 'RGB(Red:=15, Green:=143, Blue:=38)
LedStanza = "LED" & NumeroStanza & "_3"
ActivePresentation.Slides(5).Shapes(X + 3 + 2).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = Arr_ColoreStatoStanza(2) 'RGB(Red:=15, Green:=143, Blue:=38)
LedStanza = "LED" & NumeroStanza & "_4"
ActivePresentation.Slides(5).Shapes(X + 3 + 3).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = Arr_ColoreStatoStanza(3) 'RGB(Red:=15, Green:=143, Blue:=38)
Else
Arr_ColoreStatoStanza = Split(ColoreStatoStanza, ",")
LedStanza = "LED" & NumeroStanza & "_1"
ActivePresentation.Slides(5).Shapes(X + 3).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = Arr_ColoreStatoStanza(0) 'RGB(Red:=15, Green:=143, Blue:=38)
LedStanza = "LED" & NumeroStanza & "_2"
ActivePresentation.Slides(5).Shapes(X + 3 + 1).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = Arr_ColoreStatoStanza(1) 'RGB(Red:=15, Green:=143, Blue:=38)
LedStanza = "LED" & NumeroStanza & "_3"
ActivePresentation.Slides(5).Shapes(X + 3 + 2).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = Arr_ColoreStatoStanza(2) 'RGB(Red:=15, Green:=143, Blue:=38)
LedStanza = "LED" & NumeroStanza & "_4"
ActivePresentation.Slides(5).Shapes(X + 3 + 3).Name = LedStanza
ActivePresentation.Slides(5).Shapes(LedStanza).Fill.ForeColor.RGB = Arr_ColoreStatoStanza(3) 'RGB(Red:=15, Green:=143, Blue:=38)
End If
X = X + 3
End If
X = X + 4
Loop
Close #1 'Chiusura File
End Sub
As the user make modifications on excel file and sent data to txt, I would like the code to be executed every 5 miuntes while presentation is running.