Since my OwnPathName is as URL: https://sec-ishare.infineon.com/sites/MC_PM/Shared%20Documents/09_Reporting/PT/2016/
my code to check if the FileName exist doesn't work anymore and i always get the error message: "Run time error '52': Bad file name or number".
this is my code:
[Private Sub CommandButton21_Click()
Dim NewFileName As String
Dim OwnPathName As String
oldWeekDay = Weekday(Now)
Select Case oldWeekDay
Case 1
NewFileName = "PT PM Weekly " & Format(Date + 4, "yyyymmdd")
Case 2
NewFileName = "PT PM Weekly " & Format(Date + 3, "yyyymmdd")
Case 3
NewFileName = "PT PM Weekly " & Format(Date + 2, "yyyymmdd")
Case 4
NewFileName = "PT PM Weekly " & Format(Date + 1, "yyyymmdd")
Case 5
NewFileName = "PT PM Weekly " & Format(Date, "yyyymmdd")
Case 6
NewFileName = "PT PM Weekly " & Format(Date + 6, "yyyymmdd")
Case 7
NewFileName = "PT PM Weekly " & Format(Date + 5, "yyyymmdd")
End Select
OwnPathName = ActivePresentation.Path
FullFileName = OwnPathName & "\" & NewFileName
'for debug only (can remove it later)
'MsgBox OwnPathName
'MsgBox FullFileName
Dim StrFile As String
Dim FileFound As Boolean
FileFound = False
'look for all types of PowerPoint files only (filter only to PowerPoint files to save time)
StrFile = Dir(OwnPathName & "\*pptm*")
Do While Len(StrFile) > 0
If InStr(StrFile, NewFileName) > 0 Then
FileFound = True
Exit Do
End If
StrFile = Dir
Loop
If FileFound Then
MsgBox "Modification already done"
Else
RemoveTextboxes
AllBlackAndDate
SaveAllPresentations (FullFileName)
End If
End Sub]
Can you help me please solving this problem