Chelsea0270516
New Member
- Joined
- Oct 15, 2015
- Messages
- 32
Hello!
I haven't written any code myself yet. But I have used recording macros & lots of google searches to get a few time savers for some of the work I do.
I have one set of code that works to delete my autolook ups (basically it copy & pastes special so no vlookups are left), then it saves the doc to a particular location, with a name that is specific to the data I put in the document. It also saves without macros enabled & closes the document.
My second set of code was written by someone on here (I saw it this morning actually!). It does something (which I cut cut out because I didn't need it) & then prompts outlook to email a specific person.
I am wondering - could someone help me figure out how to combine the two sets of code to make a different set that does the following:
I am using an existing form & can't add in any lines to the excel sheet to help create the name which is an area I am running into trouble with. Before I just had a hidden tab that compiled all the information I needed to create the correct name for the document. Now I need to figure out how to combine these things in VBA which is one of my big issues.
functioning delete auto lookups
<tbody>
</tbody>
email Code/what I have so far - red part is wrong but I don't know how to make it right. Light blue I changed but I am not sure the change is right.
<tbody>
</tbody>
I haven't written any code myself yet. But I have used recording macros & lots of google searches to get a few time savers for some of the work I do.
I have one set of code that works to delete my autolook ups (basically it copy & pastes special so no vlookups are left), then it saves the doc to a particular location, with a name that is specific to the data I put in the document. It also saves without macros enabled & closes the document.
My second set of code was written by someone on here (I saw it this morning actually!). It does something (which I cut cut out because I didn't need it) & then prompts outlook to email a specific person.
I am wondering - could someone help me figure out how to combine the two sets of code to make a different set that does the following:
- Automatically saves the document with the following format
- [Contents of C14]&"-WHSE130-Display Order CMM-"&Today()
- Today in MMDDYY format
- Example: 2211-WHSE130-Display Order CMM-042216
- It needs to be saved in a particular location.
- It needs to be saved as a basic workbook (no macros enabled)
- It needs to email me once it is saved with the item attached & the name of the document as the subject of the email.
I am using an existing form & can't add in any lines to the excel sheet to help create the name which is an area I am running into trouble with. Before I just had a hidden tab that compiled all the information I needed to create the correct name for the document. Now I need to figure out how to combine these things in VBA which is one of my big issues.
functioning delete auto lookups
Sub DeleteAutoLookUps() ' ' DeleteAutoLookUps Macro ' ' Keyboard Shortcut: Ctrl+Shift+Q ' Range("A1:M73").Select Selection.Copy ActiveWindow.SmallScroll Down:=-33 Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False ActiveWindow.SmallScroll Down:=-15 Sheets("coding").Select ActiveWindow.SelectedSheets.Visible = False Sheets("Vendors").Select ActiveWindow.SelectedSheets.Visible = False Sheets("Paste Here").Select ActiveWindow.SelectedSheets.Visible = False Range("Q11").Select 'Save as function per stack overflow Application.ScreenUpdating = False 'Exit if U2 is empty If ActiveSheet.Range("U2").Value = vbNullString Then Exit Sub ThisFile = ActiveSheet.Range("U2").Value ActiveWorkbook.SaveAs "L:\data\Marketing\Z Shared Outside Files\Retail Store Displays\Chelsea\Waiting to be placed\" & ThisFile, FileFormat:=xlOpenXMLWorkbook Application.ScreenUpdating = True ActiveWorkbook.Close End Sub |
<tbody>
</tbody>
email Code/what I have so far - red part is wrong but I don't know how to make it right. Light blue I changed but I am not sure the change is right.
Sub EMAIL() Dim OAPPS As Object Dim OMAIL As Object Dim LWORKBOOK As Workbook Dim LFILENAME As String Application.ScreenUpdating = False ActiveSheet.Copy Set LWORKBOOK = ActiveWorkbook LFILENAME = AND (ActiveSheet.Range("C14")),("-WHSE130-Display Order CMM-"),(ActiveSheet.Range("O4")),("ActiveSheet.Range("C14")) On Error Resume Next Kill LFILENAME On Error GoTo 0 LWORKBOOK.SaveAs Filename:=LFILENAME Set OAPP = CreateObject("OUTLOOK.APPLICATION") Set OMAIL = OAPP.CREATEITEM(0) With OMAIL .To = "chelsea@abcdef.com" .Subject = LWORKBOOK.FullName .ATTACHMENTS.Add LWORKBOOK.FullName .DISPLAY End With LWORKBOOK.ChangeFileAccess Mode:=xlOpenXMLWorkbook Kill LWORKBOOK.FullName LWORKBOOK.Close SAVECHANGES:=False Application.ScreenUpdating = True Set OMAIL = Nothing Set OAPP = Nothing End Sub |
<tbody>
</tbody>