Syntax Error

  • Thread starter Thread starter trevor.niemack
  • Start date Start date
T

trevor.niemack

I have got some code to attach a doc to an email but I have a few
problems with it.
The first is a syntax error on the code below:

ElseIf ListBox1.Items.ToString <> ("") Then

Dim Counter As Integer
For Counter 0 To listbox1.Items.Count - 1

the 0 is underlined with a syntax error.

The other thing is that actual attachement, I have used the open
dialogue to select a file and it comes back with a unhandled exception
as below:

Could not find file 'C:\System.Windows.Forms.ListBox+ObjectCollection'.
 
I have got some code to attach a doc to an email but I have a few
problems with it.
The first is a syntax error on the code below:

ElseIf ListBox1.Items.ToString <> ("") Then

What exactly do you want to archieve?
Dim Counter As Integer
For Counter 0 To listbox1.Items.Count - 1

the 0 is underlined with a syntax error.

'For Counter As Integer = 0 To ListBox1.Items.Count - 1'.
 
Okay don't worry I got it to work:
Dim Counter As Integer
Counter = ListBox1.Items.Count - 1
Dim emailAttachment As Attachment = New
Attachment(ListBox1.Items(Counter))

I do however need some help taking various text fields and adding them
to a word template that I can create. And then add to the email going
out or maybe to the email body.
 
Back
Top