Email VBA User Form to one account.

TH1993

New Member
Joined
Aug 21, 2013
Messages
1
Hello, I am currently producing a spreadsheet which can be accessed my multiple users. I have included a button in which opens a VBA User form. I want the users to fill in the details and when they press send, the form comes to me in that form with a clear subject field and body field. Everyone using the company has a company computer so they can only access their own accounts without signing out.
I have been looking all through the internet but cannot seem to find the correct coding for my scenario.
Any help would be great!
Thanks
TH1993
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
I just found some code like this online

Code:
Private Sub CommandButton1_Click()
Me.Hide


 'Variable declaration
    Dim oApp As Object, _
    oMail As Object, _
    WB As Workbook, _
    FileName As String
     
     'Turn off screen updating
    Application.ScreenUpdating = False
     
     'Make a copy of the active sheet and save it to
     'a temporary file
    ActiveSheet.Copy
    Set WB = ActiveWorkbook
    FileName = "Temp.xls"
    On Error Resume Next
    Kill "C:\" & FileName
    On Error GoTo 0
    WB.SaveAs FileName:="C:\" & FileName
     
     'Create and show the outlook mail item
    Set oApp = CreateObject("Outlook.Application")
    Set oMail = oApp.CreateItem(0)
    With oMail
         .To = "YourEmailAddress@Whatever.com"
         'Uncomment the line below to hard code a subject
         '.Subject = "Look at my workbook!"
        .Attachments.Add WB.FullName
        .Display
    End With
     
     'Delete the temporary file
    WB.ChangeFileAccess Mode:=xlReadOnly
    Kill WB.FullName
    WB.Close SaveChanges:=False
     
     'Restore screen updating and release Outlook
    Application.ScreenUpdating = True
    Set oMail = Nothing
    Set oApp = Nothing


End Sub

Just add some code like this to a command button called "Submit Form" and when they have there details entered it should just send the sheet they just filled in to your email address
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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