• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Add extra folder to line of code

Hello helpers
I have this line of code of
Code:
  foto = ActiveWorkbook.Path & "\" & fotoNaam & ".jpg"
I would like to change that so the photo's are saved in a separate folder called photos
Thanks in advance
 
So "photos" will be subfolder inside the folder where workbook is located? I'd do something like...
Code:
Dim foto As String, fotoPath As String
fotoPath = ActiveWorkbook.Path & "\photos"
If Dir(fotoPath, vbDirectory) = vbNullString Then
    MkDir Path:=fotoPath
End If
foto = fotoPath & "\" & fotoNaam & ".jpg"
 
Hello Chihiro;
Thank you for your very fast reply,Your code works fine, but now I have another problem, this picture should load from the subfolder when I open another userform
This is the code
Code:
Private Sub ScrollBar1_Change()
If MagLaden Then
    For i = 1 To 10
        Controls("label" & i).Caption = Sheets("ledenbestand").Cells(ScrollBar1.Value, i)
        Controls("textbox" & i).text = Sheets("ledenbestand").Cells(ScrollBar1.Value, i + 10)
    Next
    On Error Resume Next
    Imagebox.Picture = LoadPicture(ActiveWorkbook.Path & "\" & Sheets("ledenbestand").Cells(ScrollBar1.Value, 10))
    fotopad.Caption = ActiveWorkbook.Path & "\" & Sheets("ledenbestand").Cells(ScrollBar1.Value, 10)
    If Err.Number <> 0 Then
    Imagebox.Picture = fout.Picture
    End If
    On Error GoTo 0
    CommandButton1.Enabled = False
End If
End Sub
Thanks
 
Hello Chihiro,
Thank you for your help, everthing works fine now
You are a great helper
Thank you
Have a nice evening
(problem solved)
 
Back
Top