|
I have been asked to include a line to send an email within an XL macro.
ActiveWorkbook.SendMail _
Recipients:="someone@somewhere.com", _
Subject:="Bank Balances " & Format(Date, "dd/mmm/yy")
This line works fine, but I get a warning...
"A Program is trying to send an email on your behalf. If this is unexpected, click deny and verify your antivirus software is up to date.
Allow Deny Help"
Is there any way to circumvent this?
I am dealing with a man who is totally techless, I need him to click one button and job done, so warnings like this are beyond him.
(My Managing Director (!))
------------------------------------
"The greatest tragedy in mankind's entire history may be the hijacking of morality by religion"
Arthur C Clarke
|
|
|
|
|
There is a way around this by using a third party DLL. It's called Outlook Redemption which gets works around the secuirty issues of Outlook, like the one that you mentioned. Take a look at http://www.dimastr.com/redemption/[^]
|
|
|
|
|
You still get a warning then.
Something along the lines off:
An external program is trying to get access.
Do you want to allow this?
and you can then give a period of time (max 10min I think) for which the warning will be suppressed.
The only way I know off is to use SMTP mailing.
|
|
|
|
|
I use Redemption.SafeMailItem to successfully send messages from Outlook with no warning messages. Although, this is from an XP OS not Vista. Maybe Tom was talking about from a Vista machine?
|
|
|
|
|
No from a windows 2003 terminal server
I do think I had the same issue on an XP but I'm not sure.
And we do have an exchange maybe that play's a role but I doubt it.
|
|
|
|
|
Hi, I have downloaded Redemption and installed.
How do I call its functionality in VBA?
I need the "SendSafeItem".
------------------------------------
"The greatest tragedy in mankind's entire history may be the hijacking of morality by religion"
Arthur C Clarke
|
|
|
|
|
In very much the same way as if you were calling the Outlook functionality as the Redemption objects provide the same methods as the Outlook objects.
This is taken from the Redemption website where you will find all the inoformation you need:
dim SafeItem, oItem
set SafeItem = CreateObject("Redemption.SafeMailItem") 'Create an instance of Redemption.SafeMailItem
set oItem = Application.CreateItem(0) 'Create a new message
SafeItem.Item = oItem 'set Item property
SafeItem.Recipients.Add "somebody@somewhere.com"
SafeItem.Recipients.ResolveAll
SafeItem.Subject = "Testing Redemption"
SafeItem.Send
|
|
|
|
|
I see thank you.
Having read through it makes perfect sense now.
I just didn't want to appear foolish, so thought better to ask first than ask after!
------------------------------------
"The greatest tragedy in mankind's entire history may be the hijacking of morality by religion"
Arthur C Clarke
|
|
|
|
|
No problem
|
|
|
|
|
Hi Arthur,
I think what Tom suggested is right , you may use a smpt Client to send a mail you can attach you excel file to the mail , just create a small exe file , which send the mail , your manager can click on the exe and the mail is sent , following is the code from one of my application , this code was used to send the mail , i hope this may help you .
it use an smtp server,please enter proper email id as marked in the comments , i have tested it from a gmail account
Dim smtpClient As New Net.Mail.SmtpClient()
Dim mail As New Net.Mail.MailMessage()
'create the message to be sent
mail.To.Add("test@test.com") ' Enter the Email of the person you want to send the mail to
mail.From = New Net.Mail.MailAddress("username@gmail.com", "Your Display Name") ' Enter Your email address
mail.Subject = "Test Message"
mail.Body = "This is a test message"
' Prepare the client to send the above message
'Attach the file as attachment
mail.Attachments.Add(new System.Net.Mail.Attachment("yourFileName.xls"))
smtpClient.Host = "smtp.gmail.com"
smtpClient.EnableSsl = True
smtpClient.Port = 587
smtpClient.Credentials = New Net.NetworkCredential("username@gmail.com", "password") 'Enter username and password of the account , you want to use to send mail
smtpClient.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
smtpClient.Send(mail)
Hope this help
|
|
|
|
|
Hi I am currently working on a app that prints a html invoice using Internet Explorer. as follows
Dim internetExplorer As New SHDocVw.InternetExplorerClass()
Dim webBrowser As SHDocVw.IWebBrowser2 = CType(internetExplorer, SHDocVw.IWebBrowser2)
'// Make the web browser visible. //
webBrowser.Visible = False
'
Dim noValue As Object = System.Reflection.Missing.Value
webBrowser.Navigate("file://" + fileName, noValue, noValue, noValue, noValue)
Threading.Thread.Sleep(1000)
'// Get access to the webbrowser's document.
Dim htmlDoc As mshtml.IHTMLDocument2 = internetExplorer.Document
Dim o As Object = ""
htmlDoc.execCommand("Print", False, o)
htmlDoc.close()
I read in the documentation that one can set a value for nCmdExecOpt to OLECMDEXECOPT_DONTPROMPTUSER for the dialog. I just can't seem to figure out where to set it. All help greatly appreaciated. Tx
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
Stephen Lintott wrote: webBrowser.Navigate("file://" + fileName, noValue, noValue, noValue, noValue) Threading.Thread.Sleep(1000)
The Thread.Sleep line is of no use. It's making the improper assumption that the page takes, at MOST, 1 second to load. It's better to check the Busy property every so often to know when the browser is ready.
You can't use that trick with the .NET version of the WebBrowser control. You have to use the COM server that IE exposes directly to do that. A sample of which can be found here[^]. The code is in C#, but is easily converted to VB.NET using any online code conversion utility or, even better, done by hand.
|
|
|
|
|
Thats all fine and good but it doesn't answer the original question. Any help with that?
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
Thanks for down-voting me, and YES, it DOES answer the original question. You cannot use the .NET WebBrowser control to do what you want. You have to use the unwrapped COM server IE exposes, THEN you can use the technique you described. I even posted a link to a code example showing you exactly how to do it.
So, how did that not answer the original post?
|
|
|
|
|
Thanks.
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
Thanks for all the help. I tryed it and it worked. Sorry for the vote. I misread your answer and acted on that. If I could take it back I would
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
hi all,
how can i move a directory (also sub directory and files) from one volume to other volume ?
Directory.Move function fails when source and target drive are different.
Please suggest
|
|
|
|
|
Dear
as much as i know you have to do complete task in two parts,
first copy all the subfoloder and files in new drive location ie. from c drive's source folder to d drive's destination folder and
second delete the folder exist in c driver ie, source folder
|
|
|
|
|
hi sumit,
sumit prakash sharma wrote: first copy all the subfoloder and files in new drive location
how can i copy folder from one drive to second
|
|
|
|
|
it's too easy and short code
now i m going to give complete code for coping and deleting
My.Computer.FileSystem.CopyDirectory("C:\SourceDirectory", "D:\DestinationDirectory")
My.Computer.FileSystem.DeleteDirectory("C:\SourceDirectory", FileIO.DeleteDirectoryOption.DeleteAllContents)
if above code is usefull then plz reply
|
|
|
|
|
it's too easy and short code
now i m going to give complete code for coping and deleting
My.Computer.FileSystem.CopyDirectory("C:\SourceDirectory", "D:\DestinationDirectory")
My.Computer.FileSystem.DeleteDirectory("C:\SourceDirectory", FileIO.DeleteDirectoryOption.DeleteAllContents)
if above code is usefull then plz reply
|
|
|
|
|
Thanks a lot sumit
5 from me
|
|
|
|
|
|
i completed one project in vb.net with msacess database.... the problem is when i came to publish the project i clicked publish from menu ........ the problem is i can't add my msacess database setup.exe file.... thats why i can't publish my project .... i need answer for my query....
|
|
|
|
|