Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default unexpected problem in VBA Code

Hi, below is most of my code that i am writing for an
automation email to be sent from excel. i've put the (#)
before the code for clarification purposes.

...my slight problem...

the code right now as written runs fine, its sent,
formated correctly, what i want, now line 6 & 8 are
commented, but i want them to be part of the message, but
when i uncomment them, line 13 returns an error, i cannot
for the life of me, figure out the problem, so if anyone
could help or suggest anything it would be truely
appreicated. and if you need the top part of the code
then just ask, thanks in advance.

~q

(1)Msg = Msg & "Please note that the referenced award will
expire on: " & Cells(r, 2) & vbCrLf & vbCrLf 'Insert
End Date

(2)Msg = Msg & "If you require a no-cost extension to
complete the work under this award, and" & vbCrLf

(3)Msg = Msg & "have not already requested an extension
via the ARL Business Office, please" & vbCrLf

(4)Msg = Msg & "contact the contract administrator
identified above at least three (3) weeks" & vbCrLf

(5)Msg = Msg & "end date to do so. If you have already
begun that process," & vbCrLf & vbCrLf

(6)'Msg = Msg & "please disregard this reminder." & vbCrLf

(7)Msg = Msg & "Thank you." & vbCrLf & "The Business
Office" & vbCrLf

(8)'Msg = Msg & "If you have any questions please reply to
this email."

(9)'Format URL to work with Mail program by replacing
spaces with %20 and returns with %0D%0A
Subj = Application.WorksheetFunction.Substitute
(Subj, " ", "%20")

(10)Msg = Application.WorksheetFunction.Substitute
(Msg, " ", "%20")

(11)Msg = Application.WorksheetFunction.Substitute(Msg,
vbCrLf, "%0D%0A")

(12)'Create the URL
URL = "mailto:" & email & "?subject=" & Subj & "&body=" &
Msg

(13)'Execute the URL ie. Start the Mail client
ActiveWorkbook.FollowHyperlink Address:=URL,
NewWindow:=True

(14)'Wait a few seconds ...
Application.Wait (Now + TimeValue("0:00:05"))
Application.SendKeys "%s"

(15)Next r

(16)End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default unexpected problem in VBA Code

oh yeah, you might want to know what the error is, its:

Run-time error '5':
Invalid procedure call or argument

thanks in advance again
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code problem puiuluipui Excel Discussion (Misc queries) 3 July 3rd 09 07:27 PM
Alt Code Problem aftamath77 Excel Discussion (Misc queries) 2 February 10th 09 11:42 PM
Code problem Ruben Excel Discussion (Misc queries) 4 August 26th 08 08:22 AM
Problem with code kk Excel Discussion (Misc queries) 0 March 15th 08 03:01 PM
Code Problem ! Mike R Excel Programming 5 August 5th 03 03:35 PM


All times are GMT +1. The time now is 11:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"