22.07.2019, 16:22 (Dieser Beitrag wurde zuletzt bearbeitet: 22.07.2019, 16:42 von WillWissen.
Bearbeitungsgrund: Formatierung
)
Hallo Community,
Ich habe hier eine Tabelle, die als Bild, in die Tabelle Mail kopiert wird.
Hier möchte ich das Bild aus Excel heraus auf den Desktop kopieren.
Habe auch einen VBA Code gefunden der das machen soll. Der Code kopiert auch was, die Frage ist wohin. Ich kann den Pfad anpassen, was muss ich dort eingeben, damit das Bild auf dem Desktop abgelegt wird.
Private Type SHITEMID cb As Long abID As Byte End Type
Private Type ITEMIDLIST mkid As SHITEMID End Type
Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" ( _ ByVal hwndOwner As Long, _ ByVal nFolder As Long, _ pidl As ITEMIDLIST) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" _ Alias "SHGetPathFromIDListA" ( _ ByVal pidl As Long, _ ByVal pszPath As String) As Long
' Standard Systemordner ermitteln Public Function GetSpecialFolder(CSIDL As _ SpecialFolderIDs) As String
Dim lResult As Long Dim IDL As ITEMIDLIST Dim sPath As String
lResult = SHGetSpecialFolderLocation(100, CSIDL, IDL) If lResult = 0 Then sPath = Space$(512) lResult = SHGetPathFromIDList(ByVal IDL.mkid.cb, _ ByVal sPath) GetSpecialFolder = Left$(sPath, InStr(sPath, _ Chr$(0)) - 1) End If End Function
Sub GetIt() Dim sPfad sPfad = GetSpecialFolder(sfidDESKTOP) End Sub