Code:
Private Sub Cmd_CARI_Click()
Dim path As String
MsgBox path
With CommonDialog1
.DefaultExt = ".jpg .png"
.InitDir = GBLpathFile
.DialogTitle = " Buka gambar Karyawan"
.Flags = cdlOFNHideReadOnly
.Filter = "Gambar Files 1 (*.jpg)|*.jpg|Gambar Files 2 (*.png)|*.png|Gambar Files 3 (*.gif|*.gif"
.FilterIndex = 1
.ShowOpen
If Trim(.FileName) <> "" Then
Text1.Text = .FileName
strPATHGAMBAR = .FileName
Image1.Picture = LoadPicture(Text1.Text)
If Right(GBLpathFile, 1) = "\" Then
path = path & "\" & "Daftar Karyawan" & "\" & Year(Date) & "\" & UCase(Format(Date, "MMMM")) & "\" & .FileTitle
Else
path = path & "\" & "Daftar Karyawan" & "\" & Year(Date) & "\" & UCase(Format(Date, "MMMM")) & "\" & .FileTitle
End If
FileCopy strPATHGAMBAR, path
End If
End With
End Sub
I don't know if this is the solution, but:
Inside the:
Code:
If Right(GBLpathFile, 1) = "\" Then
path = path & "\" & "Daftar Karyawan" & "\" & Year(Date) & "\" & UCase(Format(Date, "MMMM")) & "\" & .FileTitle
Else
path = path & "\" & "Daftar Karyawan" & "\" & Year(Date) & "\" & UCase(Format(Date, "MMMM")) & "\" & .FileTitle
End If
both results (Then & Else) are equal
also, it would be better if you format the month to "mmmm" instead of "MMMM"