473,473 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Skipping lines within a listbox

Is there any way to skip lines programatically within a listbox as there
is in a textbox? I have a listbox on a form which gets populated with
the attachments I want to send with an e-mail but they are all mashed
together and ideally I would like to skip a line between each
attachment.

here is the code:

For Each vrtSelectedItem In .SelectedItems
LstAttachment.AddItem (vrtSelectedItem)
-->code to skip a line should go here(I think!)
Next

--End code--

Thank you

Colin

P.S. Pieter, If you see this I am still not able to send more than one
attachment. I do not know where I am going wrong but your continued
assistance is appreciated!!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #1
5 2287
ColinWard <je*********@hotmail.com> wrote in message news:<41**********************@news.newsgroups.ws> ...
Is there any way to skip lines programatically within a listbox as there
is in a textbox? I have a listbox on a form which gets populated with
the attachments I want to send with an e-mail but they are all mashed
together and ideally I would like to skip a line between each
attachment.

here is the code:

For Each vrtSelectedItem In .SelectedItems
LstAttachment.AddItem (vrtSelectedItem)
-->code to skip a line should go here(I think!)
Next

--End code--

Thank you

Colin

So when you do something like

with olkMsg
.Attachments.Add(strFile1)
.Attachments.Add(strFile2)
.Display
end with

you only get one attachment?

Could you post the part of the code where you add attachments?
Nov 13 '05 #2

Hi pieter. here is the code for the module that actually composes and
sends the message.

--Start Code--

Public Function SendMessage() As Boolean
' The SendMessage() function reads user entered values and
' actually sends the message.

On Error Resume Next

Dim strRecip As String
Dim strSubject As String
Dim strMsg As String
Dim strAttachment As String

strSubject = Forms!FrmSendMail!TxtSubject
strRecip = Forms!FrmSendMail!TxtRecipient
strMsg = Forms!FrmSendMail!TxtBody
strAttachment = Forms!FrmSendMail!LstAttachment

' Any amount of validation could be done at this point, but
' at a minimum, you need to verify that the user supplied an
' Email address for a recipient.
If Len(strRecip) = 0 Then
strMsg = "You must designate a recipient."
MsgBox strMsg, vbExclamation, "Error"
Exit Function
End If

' Assume success
fSuccess = True

' Here's where the real Outlook Automation takes place
If GetOutlook = True Then
Set mItem = mOutlookApp.CreateItem(olMailItem)
mItem.Recipients.Add strRecip
mItem.Subject = strSubject
mItem.Body = strMsg

' This code allows for 1 attachment, but with slight
' modification, you could provide for multiple files.
If Len(strAttachment) > 0 Then
mItem.Attachments.Add strAttachment
End If
mItem.Send
End If

' Release resources
Set mOutlookApp = Nothing
Set mNameSpace = Nothing

If Err.Number > 0 Then fSuccess = False
SendMessage = fSuccess
End Function

--End Code--

So somehow I have to get the files that the user picked from the
openfile dialog and attach them but I cant get my head around how to do
more than one.

Thanks Pieter

Colin


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #3
Hi guys.

I figured out how to skip a line within a listbox. I simply added this
line within the For Each...Next loop:

LstAttachment.AddItem ""

it works as intended but I am wondering if there any dangers to doing it
this way?

thanks

Colin

P.S. Pieter, I still haven't figured out my attachment problem. I really
do appreciate all the help though. I'm sure the problem is my not
understanding how this loop should work.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #4
ColinWard <je*********@hotmail.com> wrote in message news:<41**********************@news.newsgroups.ws> ...
Hi guys.

I figured out how to skip a line within a listbox. I simply added this
line within the For Each...Next loop:

LstAttachment.AddItem ""

it works as intended but I am wondering if there any dangers to doing it
this way?

thanks

Colin


What happens if the user chooses a blank line? I guess if it's blank,
there's nothing to add, though...

"that's the problem with evaporated water... I mean, what do you add?"
-Steven Wright
Nov 13 '05 #5
Pieter,

The listbox simply displays the attachments that were chosen from the
openfile dialog. The listbo is locked so the user can't do anyhting with
it anyway.

thanks pieter

Colin
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: R.Wieser | last post by:
Hello All, I'm trying to get a "Virtual Listbox" to work. I've currently got a form, and used CreateWindowExA to create a ListBox with the LBS_OWNERDRAWFIXED and LBS_NODATA flags on it. I've...
5
by: Geoff Bennett | last post by:
While parsing an XML document, my TextReader instance skips nodes. For example, in this fragment: <Person Sex="Male" FirstHomeBuyer="No" YearsInCurrentProfession="14"> <RelatedEntityRef...
7
by: Byron | last post by:
I'm looking for a way to deny a move from the current listbox item. For instance, if the user is editing the record associated with the current listbox item I want to deny a move within the...
6
by: Mokka | last post by:
Hi, I have this listbox and I would like to lock some of the lines so that the user can't select them. It's the 2 main areas "2798 Mokka" and "3892 Juice" I don't won't the user to be able to...
15
by: allansiu823 | last post by:
Hi I am new to MS Access and VBA and have been bothered by this problem for a looooong time. I have this listbox containing all the records (~1000) in a form and I want to be able to type something...
7
by: Gustaf | last post by:
Hi all, Just for fun, I'm working on a script to count the number of lines in source files. Some lines are auto-generated (by the IDE) and shouldn't be counted. The auto-generated part of files...
0
by: Jerry Coffin | last post by:
In article <4fae62b0-6858-4e9e-830e-9eecf6691d4a@ 59g2000hsb.googlegroups.com>, friend.blah@googlemail.com says... Each time you read from the file, keep track of the file position after...
4
by: BibI | last post by:
Hi there, I just started programming with PERL and am trying to put together my first little data manipulation program. I am working on a MAC with OSX. I have a data file with the following...
11
by: Mai Phuong | last post by:
Hi all, I have a page of aspx and a listbox. I want to format font for 3 last lines of my listbox with Bold Style by code. Notice that my lisbox has more than 3 lines, and I don't know exactly...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.