05-26-2023
12:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
05-26-2023
12:25 AM
There is an some arrangement. I added the possibility to add an .dwg file with the use of an custom text parameter. When you run the code an arraylist will pop up with the option with person to contact. The email program used is Outlook.
'Messagebox open outlook. If incorrect program will crash. Question_1=MessageBox.Show("Is outlook open?", "DMF Automation",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question) If Question_1=vbNo Then Dim Proc As String = "Outlook.exe" Process.Start(Proc) End If If Question_1 = vbCancel Then Exit Sub End If 'Contact list Dim oUser As New ArrayList 'Contact list namelist 'Change "NAME" to your wanted contact name oUser.Add("NAME") oUser.Add("NAME") ' oUser.Add("") oUser.Add("Other") u1 = InputListBox("", oUser, oUser, Title := "Title", ListName := "Email exporter") 'Emailadres 'Put in the same contact name as before at the place "NAME" and email adres that at "EMAILADRES" If u1 = "NAME" Then : o1 = "EMAILADRES" : End If If u1 = "NAME" Then: o1 = "EMAILADRES" : End If If u1 = "" Then : Return: End If If u1 = "Other" Then : o1 = "" : u1 = "" :End If 'Run PDF code iLogicVb.RunRule("PDF") 'Create Email Contents oPerson = u1 oEmailAddress = o1 oOApp = CreateObject("Outlook.Application") oOMail = oOApp.CreateItem(olMailItem) oAdressee = "Dear " + oPerson & vbLf & vbLf & "You can see the drawings in the appendix. These relate to project:" + ThisDoc.FileName oFileName = vbLf & vbLf & "Best regrads," oFrom = iProperties.Value("Summary", "Author") With oOMail .To = oEmailAddress .Subject = "Project: " + ThisDoc.FileName .Body = oAdressee + oFileName & vbLf & vbLf & oFrom If PDF_mail="Ja" Then objOutlookAttach = .Attachments.Add(ThisDoc.Path + "\WT.pdf") End If If DWG_mail="Ja" Then objOutlookAttach = .Attachments.Add(ThisDoc.Path + "\" + ThisDoc.FileName + ".dwg") End If .Display End With