Welcome, Guest. Please Login or Register.
July 15, 2025, 07:32:00 AM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  English User Help  |  English Help  |  Visual Basic for Applications anyone ? « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Visual Basic for Applications anyone ?  (Read 406 times)
Webby
Beta Tester
YaBB God
*****
Posts: 829


Some mistakes are too funny to make only once.

ICQ - 9814812webby@salesplaza.nl WWW
Visual Basic for Applications anyone ?
« on: May 16, 2003, 07:09:19 PM »
Reply with quote

Who knows the solution for this :

I generate mailings through Excel, and let it send automatically with a Macro.  So far so good, it works with the following code :

Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Sub Wanbetaal_1_mail()
   Dim Email As String, Subj As String
   Dim Msg As String, URL As String
   Dim r As Integer, x As Double
   For r = 1 To 8 'data in rows 1-8
'       Get the email address
       Email = Cells(r, 2)
       
'       Message subject
       Subj = "SalesPlaza"

'       Compose the message
       Msg = ""
       Msg = Msg & Cells(r, 3) & "," & vbCrLf & vbCrLf
       Msg = Msg & "Bladiebladiebla,"
       Msg = Msg & "Met vriendelijke groet," & vbCrLf & vbCrLf
       Msg = Msg & "M.v.Veelen" & vbCrLf
       Msg = Msg & "SalesPlaza"

'       Replace spaces with %20 (hex)
       Subj = Application.WorksheetFunction.Substitute(Subj, " ", "%20")
       Msg = Application.WorksheetFunction.Substitute(Msg, " ", "%20")
               
'       Replace carriage returns with %0D%0A (hex)
       Msg = Application.WorksheetFunction.Substitute(Msg, vbCrLf, "%0D%0A")
'       Create the URL
       URL = "mailto:" & Email & "?subject=" & Subj & "&body=" & Msg
       
'       Execute the URL (start the email client)
       ShellExecute 0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus

'       Wait two seconds before sending keystrokes
       Application.Wait (Now + TimeValue("0:00:05"))
       Application.SendKeys "%s"
   Next r
End Sub


Now I want to add attachments (see the last column), what do I have to do to get it to work ??  I tried almost everything I think.....

« Last Edit: May 16, 2003, 07:15:05 PM by Webby » Logged

Webby of salesplaza.nl
The YaBBSE buttongenerator : Click HERE !
andrea
Global Moderator
YaBB God
*****
Posts: 4400


Peace on Earth

WWW
Re:Visual Basic for Applications anyone ?
« Reply #1 on: May 16, 2003, 09:33:36 PM »
Reply with quote

If you have outlook installed you can use the outlook command line options. "/a" is for attachments as far as I remember.
Logged

Pages: [1] Reply Ignore Print 
YaBB SE Community  |  English User Help  |  English Help  |  Visual Basic for Applications anyone ? « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.124 seconds with 21 queries.