Nun möchte ich immer das aktuellste Bild im Sheet(PDF1) einfügen
BItte um Hilfe :)
Sub BildRein()
Sheets("pdf1").Pictures.Insert (LastPIC("c:\test\"))
End Sub
Function LastPIC(strPath As String) As String
Dim lngMaxDate As Long
Dim strFile As String, strTmp As String
Const strMuster = "Summeberechnung_"
If Right(strPath, 1) "\" Then strPath = strPath & "\"
strFile = Dir(strPath & strMuster & "*.gif", vbNormal)
Do While Len(strFile)
strTmp = Mid(strFile, 17, 14)
lngMaxDate = Application.Max(lngMaxDate, --strTmp)
strFile = Dir
Loop
LastPIC = strPath & strMuster & lngMaxDate & ".gif"
End Function
Gruß
Option Explicit
Public Sub InsertPicture()
Dim strFilename As String, astrTemp() As String
Dim strFolder As String, strPath As String
Dim lngptrTemp As LongPtr
strFolder = Environ$("TMP") & "\"
strFilename = Dir$(strFolder & "SummeBerechnung_*.gif")
Do Until strFilename = vbNullString
astrTemp = Split(Left$(strFilename, InStrRev(strFilename, ".") - 1), "_")
If astrTemp(1) Like "##############" Then
If lngptrTemp
Gruß