I'm creating a file that holds a list of names with various details held, but what I need to do, is attach a hyperlink to a column 'L' in the same row as the user selects, the user will be able to select the row based upon a unique reference in a listbox in a userform.
I have the following code which attaches the hyperlink to the selected cell, but I'm at a loss as to how I would go about setting the cell based upon the unique reference....
For arguments sake, lets say the unique references are all in column A, and they are 2 to 50 (in rows 2 to 50 for ease of explanation)
The code that I have to insert the Hyperlink is as follows, userform has three buttons and a textbox, but I know that I will need to add the listbox in the form to select the cell to paste
Code:
Private Sub CmdBrowseHyperlink_Click()
'Browse for the file which I want to attach to the cell
Dim FileName As String
FileName = Application.GetOpenFilename()
TextBox1.Value = FileName
TextBox1.SetFocus
I have an Excel file that has a persons name in column A, company name in column B, email address in column C and a hyperlink to a specific file to be sent with the email in column D.
I have the code to send the email and it works fine.
I've searched the net for mail merge and hyperlinks and have only become confused.
Here is what I want to do, attach the mail merge created file to the email, then the file associated with the hyperlink, I want to attach the actual file from the hyperlink into the email.
I am looking to create a VBA code that can create hyperlinks for me.
If you look at the picture what I'm looking for is an code that will take the hyperlink from the second column to the right of the column containg "Excl." (here it is column I) and attach as an hyperlink to the corresponding row in the last filled column. The vba code should check the cells in the first row to verify if data is there (Cell D1, E1.....).
In the example attached the code should take the link in K2 and attach to E2, K3 to E3, skip K3 and K4, attach link from K5 to E5 and so on, until the last row (sometimes 100, sometimes 200).
If there weren't a date in E1, but only in D1, then the links should have been attached to as K2 to D2, K3 to D3 and so on.
It is important that a hyperlink is not attached if the cell is blank. (had problems with this as well).
For the hyperlink formula I have used =IF(G4"";HYPERLINK("C:UsersTommyDropboxXYZ"&G4&".jpg");"")
I have this code that looks through my worksheet once the conditions are met it will email, and in column "M" I put a hyperlink to where the document is stored. All works as far as the email format, even grabs the hyperlink but it’s not clickable in the email.
Here is the code.
I am outlook 07 and vista 07.
Option Explicit Const Startingrow = 11 'Data starts on row ## Const AlarmDelay = 183 'send warning Sub CheckTimeLeftFac() 'References needed : 'Microsoft Outlook Object Library
Dim i As Long Dim j As Long Dim msg As Long Dim Lastrow As Long Dim WhoTo As String Dim SubjectLine As String Dim MessageBody As String Dim olMail As Outlook.MailItem Dim olApp As Outlook.Application Dim strLink As String
I am using a macro to e-mail any work sheet with an address in A1. I would also like to attach a file that will be listed in cell E1 of that worksheet. The file is different for each work sheet that is being sent but will be listed in the same cell of each work sheet.
This is the code I am using (i got it from ron de bruin) when I use the .Attachments.Add (C:est1.txt) it works but i can not seem to figure out how to get it to read the file address in the E1 cell. The code i am trying to use is .Attachments.Add = ws.Range("E1").value.
I am trying to attach a counter to a variable. I am trying to attach the counter "k" to the variable "A", instead of separately writing code for A1, A2, A3, and A4. Each variable corresponds to the same worksheet function calculation (such as average in this case), but refers to a different set of data. So, if I run the following code, it does not work. I know how to do it using an array.
VB: Option Explicit Dim A1 As Double, A2 As Double, A3 As Double, A4 As Double Dim k As Integer
I have a sheet with an invoice on and wish the Macros to make it easy for users.
I have this code which saves as PDF, Prints and saves my worksheet. However I want to send the PDF to Outlook with To: and cc: completed using the Macro.
Sub PlasticParts() 'Saves active worksheet as pdf using concatenation 'of A1,A2,A3 Dim fName As String With ActiveSheet fName = .Range("A1").Value & .Range("F2").Value & .Range("A3").Value .ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ " [Code] ..........
I have been trying to find a method to attach a worksheet to an email WITHOUT sending it. I want my user to be able to create the attachment file and then add some text before sending.
also, I have been playing around with Ron Debruin's code to send one worksheet, found at [url] this is the closest i have found to what I need. except it sends the mail for you. and I can't get it to copy and paste as values only one cell on the worksheet (not the entire worksheet as values).
here is his code Sub Mail_ActiveSheet() 'Working in 97-2007 Dim FileExtStr As String Dim FileFormatNum As Long Dim Sourcewb As Workbook Dim Destwb As Workbook Dim TempFilePath As String Dim TempFileName As String Dim AddresseeName As String
send automaticaly, or it waits until user will push button send or brows to attach the file.
In all given samples it says: “If you use Microsoft Outlook”. I know that any office has Outlook. Is it impossible to make Outlook usable with macro and then send an e-mail?
I have a VBA procedure that I need to be able to link/attach to an excel file which is created on the fly, and I need to do this programatically / on the fly. Basically, currently from my front end app, I output the necessary data to excel, and then format that data in excel using vba code sent through OLE to excel. Right after the formatting is done, I would like to then send the necessary vba commands to excel that would take my existing VBA sub routine, link it somehow to my excel file (by inserting it as a macro?, by registering/linking it as a .bas file?, any other options/ideas?), and then give the user a button or shortcut in the excel file that will run that VBA sub routine.
The underlined part above is my main goal here, and I already have the rest covered. I know there is more than one solution for this, but I would prefer a solution that allows me to store the vba code in the excel file itself, so that I only need to distribute the .xls file whenever I want to deploy this spreadsheet somewhere new.
I have this Macro working almost perfectly, but I need to attach the worksheets to the emails. The code is below. I am unable to reference the ".Attachments" to the workbook created previously in the code.
Sub ActivityReport() ' Clear out any old data on Report Sheets("Report").Select
I'm generating a letter (Word doc) and populating bookmarks with data on a worksheet using the following code which is assigned to a Button and it works a dream (in terms of opening the Doc and populating the bookmarks with whatever data is in the relevant cells on the worksheet):
Sub test() Dim objWord As Object Dim ws As Worksheet Set ws = ThisWorkbook.Sheets("Sheet1") Set objWord = CreateObject("Word.Application") objWord.Visible = True objWord.Documents.Open "location of the letter.doc"
[code]......
However, what I now need to do is Create an Outlook Item (email) with a Standard Subject and send to an email address that will be on the same worksheet (in cell M2 for instance) and with a standard Body.
I dont really need to open the Word doc, like it does at present, but I do need the Bookmarks contained within it to be populated with the source data contained within the Worksheet and subsequently have it attached to the email fully populated - maybe I need to 'close' / 'save as & close' the Doc post generation?
I have 3 routines to (1) create an empty zip folder, (2) place a file into the zip folder and (3) create a mail item and attach the zip folder to it.
The zip folder is successfully created. The mail item is also created and displayed, yet the zip file does not get attached.
Option Explicit
Dim FileNameZip
Sub NewZipFile(strFilePath As String) If Len(Dir(strFilePath)) > 0 Then Kill strFilePath Open strFilePath For Output As #1 Print #1, Chr$(80) & Chr$(75) & Chr$(5) & Chr$(6) & String(18, 0) Close #1 End Sub
Sub MakeZipFile(strPath As String)
Dim strFileName As String Dim objApp As Object
With Application .EnableCancelKey = xlDisabled .ScreenUpdating = False.......................
I have a form that loads and depending on the word selected in the drop down the following code loops through cells Q2:AC2 until it finds the word in one of those cells (the word will always be in one of the cells)
Code: For Each c In Range("Q2:AC2").Cells If c = period Then c.Select
[Code]...
The active cell it finds will always change, i know I need something to code the active cell back but I don't know what it should be.
I have hyperlinks betwene one worksheet to another - they only only hyperlinked thourh column & rows (eg: A100) etc. How can I lock these hyperlinks but still allow users to insert new rows without losing their place?
I am having a slight problem copying hyperlinks. I have written some code that sorts data by date and then creates a simple diary. It originally placed the name of the event in the new diary sheet. What I would like to do is instead of copying the name into this new sheet copy a hyperlink that I have created to the company's website for that event.
I can create the hyperlink using hyperlink(B1,A1) where A1 is the company name and B1 is the web address but since the new sheet will not have the underlying data I need to actually copy the values and format of the hyperlink rather than the formula.
show me the visual basic codes that allow me to attach the current saved workbook to an email (just attach, but not to send the file). So basically, just open the Outlook, send to, and attach the file.
I would like to attach a pdf (or word) file inside an Excel sheet so that it is seen as a pdf icon or word icon when viewing the sheet. Any of you who knows if this is possible and how to do it?
I am trying to attach an Excel file to a post. I found the following in FAQ: "To attach a file to a new post, simply click the [Browse] button at the bottom of the post composition page, and locate the file that you want to attach from your local hard drive" But I cannot find the [Browse] button. I should have said "to attach a file" not "to attach a post" in the header.
I am creating a large vlookup. I have multiple instances of a name, twenty to be exact. I copy the first cell it is name1 and then I paste it for the next 19 cells below. Is there a quick way that I could have it go name2 name3 name4 etc all the way to 20? Currently I am just having to click and change the value manually.
I have two sheets that contain data and I have to switch between them all the time, and I thought I could make it easy by assigning the "switch" to a macro. I am now looking to assign that macro so a single button, like the "`" key. I have tried various pieces of code but none of them worked.I think something like the below may work but I don't know how to start.
[Code]....
If Sheets("Sheet2") is active, then call switch 1, to switch back.
I have a workbook with a large number of worksheets in it. I intend putting the workbook onto a shared network drive so that a number of users can go into their individual named sheet - check some data and confirm that they have checked it.
My initial idea is to attach a command button to each individual sheet so that each user can click on the button to confirm that they have checked their data. What I would like to do is hide a worksheet within the workbook and when each user has checked their data - their button click will insert a tick in the relevant cell of the hidden worksheet e.g.
When User 1 clicks command button on User 1 sheet it will insert a tick in cell B2 of the hidden sheet
When User 2 clicks command button on User 2 sheet it will insert a tick in cell B3 of the hidden sheet
I wrote this code years ago to Auto Send Emails from Outlook...
Sub Emailfile()
Dim OutlookApp As Object Const olMailItem = 0 Set OutlookApp = CreateObject("Outlook.Application") Dim EmailContent As String With OutlookApp.CreateItem(olMailItem) EmailContent = Range("A1").Value .To = "Test" .Subject = "LSG Data File" .Body = EmailContent .Attachments.Add ("P:MI TeamICCE LEADS EXTRACTSLSGLSG Data File")
End With
End Sub
I can't figure out how to get it working for Lotus notes... So 2 things I guess really... Firstly is it possible? Second: If it is, how can I get it to send say 16 emails each with a specific attachment but the same commentary?
I want a list to be sorted when a user closes the Excel DataForm. I have the code to execute the sort but how do I attach it to the DataForm Close button?
I have a table which says that this is the amount of coloured cells we have in another sheet.
For e.g.
Field Name Code A Item Description 5
Now, the item description column has 5 cells in another sheet which are filled in with "Yellow" Colour. So what i want to do is to click on this 5 in sheet 2 in this case as per the attached sample which takes me to the filtered result on sheet1 of 5 yellow coloured cells under the column of Item description including an additional filter of Code "A"
I have an index of 80,000 names from an index. Some names appear in multiple volumes and on multiple pages within a volume. While the name is the same, they are different people. The Roman numeral is the volume and the numeric is the page number.
Example of original data: Joe Shmoe V-225, 310 VIII-22, 86, 110
I have separated the data into separate columns. Now I have:
Col 1 Col 2 Col 3 Col 4 Col 5 Col 6 Joe Shmoe V-225 310 VIII-22 86 110
At this point, I want to combine the Roman numeral in Col 2 with Col 3 and 4 and combine the Roman numeral in Col 4 with Col 5 and 6.
There are way too many records for me to manually enter the Roman numeral where missing.