1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
'---------------------------------------------------------------------------------------
' Module : Tools
' Author : abillo
' Date : 11/02/2011
' Purpose :
'---------------------------------------------------------------------------------------
'---------------------------------------------------------------------------------------
' Procedure : PublierTableauDeBord
' Author : abillo
' Date : 07/03/2011
' Purpose :
'---------------------------------------------------------------------------------------
'
Public Sub PublierTableauDeBord()
Dim ZonePubli As String
Dim FichierPubli As String
Dim oPublish As PublishObject
Dim bAutoFilter As Boolean
On Error GoTo PublierTableauDeBord_Error
bAutoFilter = False
Log ("Initialisation de la publication du tableau de bord (PublierTableauDeBord)")
' Nom du fichier
FichierPubli = ThisWorkbook.Path & "\Suivi Web.htm"
' Zone à Publier
ZonePubli = Range("TableauDeBord").CurrentRegion.Address
' Test s'il y'a un filtre auto
bAutoFilter = Not (Range("TableauDeBord").Worksheet.AutoFilter Is Nothing)
' S'il y'a un filtre automatique, on l'enlève
If bAutoFilter = True Then
Range("TableauDeBord").AutoFilter
End If
'Objet à publier
Set oPublish = ThisWorkbook.PublishObjects.Add( _
SourceType:=xlSourceRange, _
Filename:=FichierPubli, _
Sheet:="Suivi Global", _
Source:=ZonePubli, _
HtmlType:=xlHtmlStatic, _
Title:="Suivi des demandes", _
DivID:="TdB")
oPublish.Publish (True)
' S'il y'avait un filtre automatique, on le remet
If bAutoFilter = True Then
Range("TableauDeBord").AutoFilter
End If
Log ("Fin de la publication du tableau de bord (PublierTableauDeBord)")
On Error GoTo 0
Exit Sub
PublierTableauDeBord_Error:
Log ("Error " & Err.Number & " (" & Err.Description & ") in procedure PublierTableauDeBord")
End Sub
'---------------------------------------------------------------------------------------
' Procedure : test
' Author : abillo
' Date : 07/03/2011
' Purpose :
'---------------------------------------------------------------------------------------
'
Sub test()
Log ("Test Log")
End Sub
'---------------------------------------------------------------------------------------
' Procedure : Log
' Author : abillo
' Date : 07/03/2011
' Purpose :
'---------------------------------------------------------------------------------------
'
Public Sub Log(sLog As String)
Dim MyFile As String
Dim fnum As Integer
Dim sLogFormat As String
MyFile = ThisWorkbook.Path & "\" & ThisWorkbook.Name & ".log"
sLog = Format(Now, "dd/mm/yyyy hh:Nn:dd") & vbTab & ThisWorkbook.Application.UserName & vbTab & sLog
'set and open file for output
fnum = FreeFile()
Open MyFile For Append As fnum
'use Print when you want the string without quotation marks
Print #fnum, sLog
Close #fnum
End Sub |