meine Tabelle bezieht aus einer Access Datenbank (in Access als Hyperlink formatiert) in die Zelle "BE12" eine E-Mail Adresse und in "BE13" eine Web Adresse.
Nun möchte ich gern, jeweils einen Schaltbutton erstellen, der entsprechend Outlook oder Internet Explorer öffnet.
Ich hab schon in Google einiges gefunden, komme aber einfach mit der Anpassung nicht klar.
Vielen Dank für eure Anregungen
Hans
Option Explicit
Private Sub CommandButton1_Click()
Dim olApp As Object, olMailItm As Object, i, lz, k As Integer, Pfad As String
Pfad = "C:\Test\" 'Hier Pfad anpassen
lz = Cells(Rows.Count, 1).End(xlUp).Row
i = 2
weiter:
Do Until i > lz
Set olApp = CreateObject("Outlook.Application")
Set olMailItm = olApp.CreateItem(0)
Cells(i, 1).Select
If ActiveCell.Value <> "" Then
With olMailItm
.To = Cells(i, 1).Value
.Subject = Cells(i, 2).Value
.Body = _
"Hallo " & Cells(i, 3).Value & "," & _
Chr(13) & _
Chr(13) & _
"Hierk kommt der Text" & Cells(i, 5).Value & _
Chr(13) & _
Chr(13) & _
"Hier kommt die Info" & Cells(i, 6).Value & _
Chr(13) & _
Chr(13) & _
Chr(13) & _
"Mit freundlichen Grüßen" & _
Chr(13) & _
Chr(13) & _
Chr(13)
.ReadReceiptRequested = True
If Dir(Pfad & Cells(i, 4).Value) <> "" Then 'Abfrage ob Anhang vorhanden
.Attachments.Add Pfad & Cells(i, 4).Value
End If
.Display 'alternativ ".Send" für direktes Versenden
End With
Else