I am trying to set up something similar to the old "print dialogue" box whereupon the user presses a command button on the userform and all sheets within the work book are listed (eg:sheet1, sheet2 etc) The user can select any amount of sheets and and using "OK" outlook is fired up- pretty similar to Ron de Bruins code for email.
I have tried taking the print dialogue vba and stooping it at copy, then trying to gets Ron's code to continue- without success.
There are great bits of code I've seen for select tabs and selct sheets from listbox, but I have found none to email once selected.
I have created a custom Menu (excel add-in) to make my work easy in excel. My problem is to print only selected sheets from Workbook in one PDF file, for that I've created a Userform with 2 listboxes, add sheet and print buttons. In the first listbox are listed all the sheets and in the second listbox are the sellected sheets to be printed. What I've succeded so far is to print selected sheets, but it creates one PDF file for each sheet, only if I put my code in workbook and not in Menu add-in (.xla file). As PDF Printer I use PDF reDirect Pro v2.
What is the code for getting Excel to send an email once I close a line item? I got some code from another post but can't get it to work for me. My current spreadsheet is a list of outstanding problems. Once the issue is "Closed" (Dropdown in column U), I would like Excel to email a recipient who's address is in Column K. The issue is in the code - If c = "Closed" Then
Sub Closed() 'You need to Reference Outlook 'Goto Tools>References and select Microsoft Outlook Libary 9.0 (or your version) Dim olApp As Outlook.Application
Sub SendEmail() 'References needed : 'Microsoft Outlook Object Library 'Microsoft Scripting Runtime Dim olApp As Outlook.Application, olMail As Outlook.MailItem Dim FSObj As Scripting.FileSystemObject, TStream As Scripting.TextStream Dim rngeSend As Range, strHTMLBody As String Dim Range1 As Range, Range2 As Range alertsSheet = ActiveWorkbook.Name Workbooks(alertsSheet).Activate Sheets("STATS").Select
Issue with this code is it is selecting wrong source range while generating email.
MsgBox Range1.Address is giving results as "$A$1:$B$1,$BX$1:$CA$1" and MsgBox Range2.Address is giving results as "$A$32:$B$38,$BX$32:$CA$38" but MsgBox rngeSend.Address is giving results as "$A$1:$B$38"
And the email generated as output is having only the data from range "$A$1:$B$38". Is there anything wrong with the way I am specifying the source range ??
I need that the code should replace strHTMLBody with the data in Range1 and Range2. I checked the tempsht.htm file and found that this file also have the same wrong data i.e. data from range "$A$1:$B$38"
Needless to specify that I am working with data having few hidden columns and need to consider only visible data.
I have used a database template from this site and changed it to suit my needs but I have a bit of a problem with some of the code. I know how to update the worksheet with the relevant userform text fields and in another project I did I have successfully sent userform text fields in the body of an email.
For this project I want to update the worksheet AND send an email at the same time. However, using the two pieces of code together is causing an error that I can't seem to solve (using my very limited vba knowledge!). The code I am working on is below and I have highlighted the line that is getting the error message. C
VB: Private Sub cmdSubmit_Click() 'Submit new record Dim ws As Worksheet, lRow As Long, Str As String [code]....
I'm working with an excel file, a userform and a command button. The command button is the main question here. Bascally when this button is clicked and email is sent to a specific person, me. This email also contains an attachment, and currently that is the active workbook open behind the userform. This works well, sort of. I sent this excel file to 5 co-workers to test. All but 1 worked OK. One, however, did not.
When the button was selected the standard Outlook message came up: "...an automated email is being sent on your behalf...select YES to continue..."...It all looks fine, but nothing happens...nothing shows up in their sent items folder and I do not receive this message.
Has anyone experienced this before? Is there a sitting with this users Outlook that prohibits the sending of automatic emails? I've added my command button code below...incase someone sees thing strange...(I am rather new to vba coding...)
I've create a userform1 that sends information via email. I have seen userforms that do the same, but that after sending, the sent email doesnt show in the sent items from outlook.
The userform has 2 tectboxes and when the person sends the email the text from the second box comes right after the first one, no space or anything. How do I separate the text by space or paragraph.
I have cobbled together a userform that works great, it prints, saves and clears as desired. Now i want to email a copy of the userform to a specific email receipiant.
I am very new to VBA and I am trying to create a userform which can be filled in and then when command button "submit" is clicked the completed form is emailed to myself. I have created the code for this but the userform is arriving as a blank attachment.
below is a VB code to email separate sheets based on sheet anme and email address on a sheet called " mail".
Code seems to fail at the last line " Next a" any ideas why this is not working
Sub Mail_sheets() Dim MyArr As Variant Dim last As Long Dim shname As Long Dim a As Integer Dim Arr() As String Dim N As Integer Dim strdate As String For a = 1 To 253 Step 3 If ThisWorkbook.Sheets("mail").Cells(1, a).Value = "" Then Exit Sub
I am working on a code which works, however, its is not working entirely as i intended. In this example, the body of the email should contain content from textbox.
I have 3 text boxes, not all are expected to be filled out. So if only textbox1 is filled out, the body should only include information derived from textbox1.
Whats happening now is that even if textboxes 2 and 3 arent filled out, the body of email produces blank formulas from textboxes 2 and 3. So how do i fix this code so that if I enter data into textbox1 only, the body of email will not include empty formulas? Ive also attached a copy of the Produced email file. Code in question is in red font
I need to make a userform that will add data to table placed (for example G12:H12), and if G13:H13 cells are written to next cells below (G14:H14). I would also want to receive auto email noticiation (or notofications by pressing another command_button) that someone add data with copied content of (G13:H13...G14:H14....) cells in email body.
Work on a spreadsheet with multiple sheets , that will then be emailed once a month, with different sheets going to different contacts because of our timezone difference.
If a sheet could be used to maintain a list of contacts and which sheet to email out Also in which format PDF, Excel (locked down) or both would be useful.
A button maybe on the contact sheet to start the process / but also with an option to set-up to email on a certain day per month would be good.
the number of contacts at the moment varies between 1 and 4 for each sheet - perhaps , we could set-up to email up to 10 contacts per sheet
The email client is Outlook
Each contact should only receive their sheet and not see any of the other sheets , also the contacts should not be able to alter the spreadsheet at all. hence the possibility of using PDF , but most still would like to see the report in excel format.
there would be about 20 sheets , to go to between 1 and 10 contacts for each sheet
I have attached a dummy workbook , which has 4 example worksheets in
In the real workbook, the worksheet names , also will have spaces in them.
I could setup a Start Sheet and a finish sheet - so that the macro - can go through each worksheet in between , if that offers a solution also a maintenance sheet which has the sheet name , email contacts email address and PDF, Excel or both format.
I have outlook on my PC , so i can play - BUT its not connected via exchange server, if that makes any difference.
I have a (MultiSelect) ListBox1 that is populated with Customer Names for the user to select from. I want the user to be able to hit the CommandButton1 adjacent to the ListBox1, and the selected Customers copy into/get added to the ListBox2.
I have the following code, adapted from other code, but it is not working:
I have a user form containing a calendar. What I'm trying to do is that if any cells are selected in a range - D4:E83 - then I want to run the userform therein forcing the user to use the calendar and ensure the date is correctly formatted. The userform is named frmCalendar.
I would like to have a userform activated when I select a specific cell "g77". I tried a code that I found while searching the forum but it did not work.
The userform name is ufMutualAid
I am not sure if it makes it any easier to write the code three times seperately or if I can put them together, but the same idea is needed for
I have created a Multipage Userform which I want to control the display when certain condition is met. I am using a button to call up this userform but I wanted to put some limitation to this form being displayed. This form will only be displayed when any of the cells in Column B Row 20 downwards or Column D Row 20 downwards are selected.
I'm probably asking something very complicated in coding but I was hoping someone could give me a macro code that would do a search for a cell's input, but only search selected sheets.
example: "Please enter the word you are searching for here, and click the enter button:"
'here' would be cell C20. the value of cell C20 would be searched for on various selected sheets written in the macro only.
I use the command ActiveWindow.SelectedSheets.Copy to copy selected sheets into a new workbook. As a result of this line is a new workbook created and a the selected sheets are pasted into the new workbook. Is it possible to paste only values by using a single line like this?
Have two sheets, both very different, but each containing Last Name, First Name and a column for email addresses (one sheet has the email addresses entered, the other does not)
What we are trying to do is look for matches in Last/First columns between the two sheets and if/when found copy the email addresses from one sheet to the other.
I've created and coded a vba userform that creates purchase orders for my projects. The user begins by selecting the project code from the combobox (the project code is a unique identifier of each project). Once the purchase order is created, the information is logged in a separate sheet called "POLog" and the userform is cleared. The project code is saved in the first column of the "POLog".
My problem is that when I have more than one purchase order to create for the same project (sometimes I have 20 or 30), the combobox starts out empty and I have to manually select the project code from the combobox. Is there a way to allow the userform to recall the last project code that was used? Maybe recalling it from the last row in the "POLog" sheet?
I currently have a user form and am trying to make a counter to that will increment if the check box is not selected, but will not increment if the check box is selected.
I am assuming I could use an if then statement for this, under the command_click OK. but I cant get it to work.
Returning items selected from a ListBox. I have a Multiselect Listbox with 15 items. Additionally, I have a worksheet with 15 columns (each one corresponding to the 15 ListBox items). I'm looking for code that will do the following:
After a user selects values from the ListBox (can be more than 1, thus the Multiselect), I would like for "TRUE" to appear in row 2 of the worksheet for each column. (IE: Column A is for Bikes, if a user selects "Bikes" from the ListBox and hits a CommandButton, I would like for A2 to say "TRUE".