vba_tester
New Member
- Joined
- Mar 17, 2019
- Messages
- 2
I'm currently trying to have the VBA running that will send the current files based on excel cells.
I have a message error on the line :
myAttachments.ADD "Sheet3.Cells(9, 2)"
The cell B,9 currently have the following value :
C:\Users\ojodoin\Desktop\Feuilledetemps.pdf
which is where I want to get the files for my email. Again, I know I can wrote it manually directly in the VBA , but I don't want this. (multiple users )
This is my actual
I have a message error on the line :
myAttachments.ADD "Sheet3.Cells(9, 2)"
The cell B,9 currently have the following value :
C:\Users\ojodoin\Desktop\Feuilledetemps.pdf
which is where I want to get the files for my email. Again, I know I can wrote it manually directly in the VBA , but I don't want this. (multiple users )
This is my actual
HTML:
Sub Stest()
Dim myFolder As String
ldress = Sheet3.Cells(6, 2)
ChDir ldress
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="Feuilledetemps"
Dim OutLookapp As Object
Dim OutLookMailItem As Object
Dim myAttachements As Object
Dim edress As String
Set OutLookapp = CreateObject("Outlook.application")
Set OutLookMailItem = OutLookapp.CreateItem(0)
edress = Sheet3.Cells(5, 2)
Set myAttachments = OutLookMailItem.Attachments
With OutLookMailItem.
To = edress.
Subject = "Feuille de temps"
myAttachments.ADD "Sheet3.Cells(9, 2)"
.Display
End With
Set OutLookMailItem = Nothing
Set OutLookapp = Nothing
End Sub