Hvorfor åbner denne dobbelt op, når mappen findes?
Private Sub btnOpenDocuments_Click()Dim besked As String
Call DoFolderExits 'GetUserAddress
If DoFolderExits = True Then
besked = MsgBox("Mappe er åbnet i baggrunden", vbInformation, "Borger Mappe")
Else
Dim nyMappe As String
'nedenstående til test
nyMappe = "c:\dokumenter\" & Me.Ejendomsnummer & ""
Call CreateFolder(nyMappe)
Application.FollowHyperlink nyMappe
End If
End Sub
Sub CreateFolder(NewDir As String)
' Her oprettes en mappe til kunden jf. sti i nyMappe
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CreateFolder (NewDir)
Set objFSO = Nothing
End Sub
Function DoFolderExits() As Boolean
Dim OpenLink As String
OpenLink = "c:\dokumenter\" & Me.Ejendomsnummer & ""
On Error GoTo Error_DoFolderExits
Application.FollowHyperlink OpenLink
DoFolderExits = True
Exit_DoFolderExits:
Exit Function
Error_DoFolderExits:
'MsgBox Err & ": " & Err.Description
DoFolderExits = False
Resume Exit_DoFolderExits
End Function