@June,
Thanks.
That works perfectly.
Now to tackle the multiple attachments part.
Thanks
@June,
Thanks.
That works perfectly.
Now to tackle the multiple attachments part.
Thanks
You might try a Split function to separate on the ";" and create an array.
Where are the document paths coming from? If you don't have a table yet, as orange suggested can use the Split() function to build array for testing purpose, like:
Sub SendEmails()
x = SendHTMLEmail("to address", "test", "test", True, , Split("C:\My Docs\test1.txt;C:\My Docs\test2.txt", ";"))
End Sub
The function doesn't return anything to the calling procedure. If you make the Function a Sub then don't need the x=.
Call SendHTMLEmail("to address", "test", "test", True, , Split("C:\My Docs\test1.txt;C:\My Docs\test2.txt", ";"))
Note that I don't have space between the path strings.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
@orange, @june;
Split() , How could I miss on that ? One of the function that goes hand in gloves with Arrays.
Am sure that will work.
Currently have a one to many tables; one table contains say the email id ( pk ) - the one side & the other table contains the actual physical paths ( on the local comp ) with email id as the FK ( the many side table ). I loop thro the records & get the attachments path.
Was wondering whether I can enter the path in the Form field using the File Browsing window instead of physically entering the path.
Thanks.
Use FileDialog to grab file paths and put them wherever you want.
Code:Dim fDialog As Office.FileDialog Dim varFile As Variant, strFile Set fDialog = Application.FileDialog(msoFileDialogFilePicker) With fDialog .AllowMultiSelect = True .Title = "Select Files" ' Show the dialog box. If the .Show method returns True, the ' user picked at least one file. If the .Show method returns False, the user clicked Cancel. If .Show = True Then For Each varFile In .SelectedItems Debug.Print varFile Next Else MsgBox "You clicked Cancel in the file dialog box." End If End With
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
I've never used Click event of textbox but I suppose that would work.
Instead of the Debug.Print you would have code to populate the textbox. Could be looping structure to build a string of multiple selections from same folder.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Don't know why. Faced a bit of issue with the code. Errors kept on creeping up saying something about FileDialog, etc.Use FileDialog to grab file paths and put them wherever you want.
Code:Dim fDialog As Office.FileDialog Dim varFile As Variant, strFile Set fDialog = Application.FileDialog(msoFileDialogFilePicker) With fDialog .AllowMultiSelect = True .Title = "Select Files" ' Show the dialog box. If the .Show method returns True, the ' user picked at least one file. If the .Show method returns False, the user clicked Cancel. If .Show = True Then For Each varFile In .SelectedItems Debug.Print varFile Next Else MsgBox "You clicked Cancel in the file dialog box." End If End With
All the same the code gave me guidelines on what to look for.
Am currently using below ( Source : http://stackoverflow.com/questions/1...ry-as-a-string) :
ThanksCode:Private Sub AttachmentLink_Click() Dim ofD As Object 'Dim Fil Set ofD = Application.FileDialog(3) ofD.AllowMultiSelect = False If ofD.Show = False Then MsgBox "User Pressed Cancel" Else txtFilePath.Value = ofD.SelectedItems(1) End If End Sub