Coding VBA Macro (Save doc with specific name in specific location & email to specific person) error in code

Chelsea0270516

New Member
Joined
Oct 15, 2015
Messages
32
Hello!

I am trying to learn how to use VBA & am still struggling to learn the language. I have a little background in programming (I took a few classes in college) but nothing training wise that is related to VBA.

That said I am trying to create a macro that will do 3 specific things:

  1. Paste into a specific cell in the document I am working in. (I'll be copying from another excel book)
  2. Save in a particular format. Both in a specific location that is on a shared drive & with the title I have set up in the sheet.
  3. Email (through outlook) to a specific email address with a generic text in the body of the email.
Here is the start of my code (I have only gotten to part 2 so far)

Code:
Sub Macro2()
'
' Macro2 Macro
'


'
    Range("C14").Select
    ActiveSheet.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:= _
        False, NoHTMLFormatting:=True
    ActiveWorkbook.SaveAs Filename:= _
         Sheets("sheet1").Cells(1, 1).value_
         FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False  **
End Sub
[/end code]

The ** is where the error is at currently.  (I haven't been able to affirm that this code does what I want it to yet since I haven't been able to figure out what to do about the error.) 

"Compile error: Syntax error"

Background information: The file that is being updated is an internal order form.  I am sending 30-70 nearly identical copies of this form to the order department with the only change being 1 cell (C14) having the pasted in ID.  

The file needs to save in the following format (which I think I figured out how to do) 
C14-CMM-DDMMYY in a particular folder.

I ended up putting this in a separate sheet & it will auto-populate the cell with what I need...I think anyway.  Name of this sheet is "sheet1"

=CONCATENATE("L:\data\Chelsea\Internal Orders\",TEXT(TEMPLATE!C14,"####"),"-CMM-",TEXT(TEMPLATE!O4,"mmddyy"))

comes out as: L:\data\Chelsea\Internal Orders\2227-CMM-101515
I am using Microsoft 2013. 

Any suggestions, coding ideas, resources, videos, etc would be appreciated.  

Thank you!
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Forum statistics

Threads
1,216,160
Messages
6,129,215
Members
449,494
Latest member
pmantey13

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top