This script sends the completed form to my email but I cannot work out how to send it formatted. I've added var space but that's a bit hit and miss. All I want is to put a line break in between each line of the HTML message. Any ideas? I've tried etc but I am getting no luc
Related
I'm using https://www.autohotkey.com/docs/AutoHotkey.htm to create a discord macro to basically spam a message in one of my servers nonstop. I want to have ctrl+4 to activate it and I want ctrl+5 to stop it, I also want it to wait until the message is sent to send the next one. I keep getting errors and cant make it work, does anyone here know how I should do it?
Easier to just send what you have copied in your clipboard.
Make a new script file (ending with .ahk) and paste this in. You can toggle it on and off with F1.
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
#MaxThreadsPerHotkey 3
F1::
Toggle := !Toggle
Loop, {
If (!Toggle)
Break
Send %ClipBoard%
Send {Enter}
Sleep 1000
}
You can tweak this if need be.
Make sure to use it only when you are allowed to.
First time poster and new to Outlook VBA.
I currently have a rule that moves all incoming mail that contains the string “Apple” in the body to a specific folder.
I ultimately want this:
On any new email that gets moved to that folder, if the body does NOT contain the word “fruit” then reply with “Deny”, a line break and then a couple sentences. The original subject and body should remain. It would act the same as if I hit the “Reply” button.
I’m getting stuck here, thank you!
I have searched and found this answer but it won't seem to work for me. I need to get the selected (highlighted) text from the subject of the email. When I try the linked solution from either the preview pane or from an open email, I only get the first character of the body. I attempted to look at all properties of mail.GetInspector.WordEditor but nothing seems to contain the selected text. As stated, mail.GetInspector.WordEditor.Application.Selection only has the first character of the body. In my code, I have mail as type MailItem and is set to ActiveExplorer.Selection.Item(1).
My code works fine when the selected text is in the body of the email.
You need to find the Windows control containing the subject and send WM_GETTEXT message to it.
I don't think you can do that in VBA.
Every day our Helpdesk has to send out a report. That report needs to link to a website that displays that days statistics.
Example URL:
http://hostname/dashboardname/date
Which would look like this:
http://hostname/HelpdeskTickets/2015-03-18
Heres what I've tried:
First I looked into field code values and doing something like this
{HYPERLINK "http://hostname/HelpdeskTickets/{DATE \# "yyyy-MM-dd"}"}
And this works, until you close the outlook message. If you don't have F9 to update the field code, and save and close the .msg file it will disappear leaving just the blank link without a date. If you hit F9 before closing it, it puts that days date into the field, however when you close and save it the field code disappears and leaves the date in place of the date field code. Also I noticed this problem doesn't happen in word. You can save and close a word file and it keeps the field codes.
Another thing I've tried is to use VBA to edit the links in the message body. So far nothing has actually worked.
The only thing that partially worked was taking the body of the document and using a string replace function on it. However this destroys all formatting and hyperlinks along with it.
I'm open to any ideas on how this can be achieved.
My main problem is that the people at the helpdesk can't seem to use anything that isn't fool proof. So having them press F9 before sending this email was actually scaring people that they wouldn't be able to do that.
You can use VBA to edit the message body programmatically. It is not clear what code you used earlier, but the main ways are described below:
HTMLBody - a string representing the HTML body of the specified item. The HTMLBody property should be an HTML syntax string.
The Word editor. The WordEditor property of the Inspector class returns an instance of the Document class from the Word object model. So, the message body is represented by the Word Document.
You can read more about all possible ways in the Chapter 17: Working with Item Bodies.
Summary: web page has a few fields to allow the user to enter payments. After the system processes the payments, the fields weren't cleared out. So my task is to simply clear them out. This is the few lines of code:
' first insert the transaction
InsertANewTransaction()
'clear out the values
txtAddTransAmount.Text = ""
ddlAddTransTypes.SelectedIndex = -1
txtComment.Text = ""
' then create and print the receipt
Payment2MsWordDoc(Payment, PaymentType, PreviousBalance, NewBalance, DueDate, ProjMinPayment)
I added the three lines in the middle resetting the values. Problem is, they don't reset. Doing some debugging the file lines of the Payment2MsWordDoc procedure are the culprit:
Response.AppendHeader("Content-Type", "application/msword")
Response.AppendHeader("Content-disposition", "attachment; filename=" + fileName)
Response.Write(strBody)
The procedure is writing an HTML receipt into the strBody and displaying it to the user. They see the 'File download, do you want to open or save this file....' and can open the receipt in ms-word. Without those three lines, the resetting works. So clearly they are messing up something, I just don't understand what.
I've got a workaround, but I'd like to know what is going on. Even to the tune of is this a correct way of creating/downloading a document. This in an inherited system, the original designer is long gone. I'm not strong in either VB or web apps so am clueless as to what the problem is.
Imagine you have a textarea on a webpage and then a regular hyperlink to a word document below that. If you type into the textarea and then click the link, do you expect the textarea to clear out? No, the browser will just launch the word document and leave the page as is. The same thing is happening with your form. Upon submit, the server is just sending a word document and since the server hasn't sent any new HTML the browser just stays as is. All of your clearing out of textfields doesn't matter because the new state is never sent down the wire. What you need to do is to send the browser new HTML and not the word doc. In the new HTML you can include a meta redirect to the word doc or better yet a download link.