Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #16  
Old October 24th, 2003, 03:07 AM
Unkie Unkie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 32 Unkie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m 27 sec
Reputation Power: 5
I'll get you on your way:

Create a file names.txt with records:
Name, Email, FileName
Name, Email, FileName

Create a form with a listbox and a command button
in the form's code enter this:

private sub Form_Load

source = AppPath & "names.txt"
Open source For Input As #1


Do While Not EOF(1)
Input #1, MyString



ListBox1.AddItem = GetSubString(MyString, 1, ",")


Loop
end sub

private sub Command1_Click
Dim Email as stirng
Dim FileName as string
Email = GetEmail(ListBox1.Text)
FileName = GetFileName(ListBox1.Text)
'Now you have the email an filenames in a string, now do your
'thing with it
end sub

Private Function GetEmail(Name as string)
source = AppPath & "names.txt"
Open source For Input As #1


Do While Not EOF(1)
Input #1, MyString



if GetSubString(MyString, 1, ",") = Name then
GetEmail = GetSubString(MyString, 2, ",")
exit function
end if


Loop

end function
Private Function GetFileName(Name as string)
source = AppPath & "names.txt"
Open source For Input As #1


Do While Not EOF(1)
Input #1, MyString



if GetSubString(MyString, 1, ",") = Name then
GetFileName = GetSubString(MyString, 3, ",")
exit function
end if


Loop

end function

Function GetSubString(str As String, StrNr As Integer, Sep As String) As String
Dim Trimmed As String
Dim Anser As String
Dim PartStr As String
Dim StrLen As Integer
Dim SepPos As Integer

Dim Count As Integer

Trimmed = Trim(str)
Anser = ""

For Count = 1 To StrNr
StrLen = Len(Trimmed)
If StrLen > 0 Then
SepPos = InStr(Trimmed, Sep)
If SepPos > 0 Then
PartStr = Left(Trimmed, SepPos - 1)
Else
PartStr = Left(Trimmed, StrLen)
SepPos = StrLen
End If
Trimmed = Trim(Right(Trimmed, StrLen - SepPos))
Anser = Trim(PartStr)
Else
Anser = ""
End If
Next Count

GetSubString = Anser

End Function


-------------------------------------------

there may be errors in this since i quickly wrote it here, but you should be able to take care of those.

Reply With Quote
  #17  
Old October 27th, 2003, 07:20 PM
josephg josephg is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: sydney
Posts: 47 josephg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 2 m 32 sec
Reputation Power: 5
Thanks to be so patient, I have created the text file and created the form and add your code, I run the macro and then press the button nothing is happening,

the names.txt file is

Toyota, totyota@hotmail.com, c:\mydata\Toyota Quarterly Q3-2003-All.xls
Toyota, totyota@hotmail.com, c:\mydata\Toyota Quarterly Q3-2003-All.xls
Toyota, totyota@hotmail.com, c:\mydata\Toyota Quarterly Q3-2003-Errors.xls
Ford, Ford@hotmail.com, c:\mydata\Ford Quarterly Q3-2003-customers.xls
Ford, Ford@hotmail.com, c:\mydata\Ford Quarterly Q3-2003-All.xls
Ford, Ford@hotmail.com, c:\mydata\Ford Quarterly Q3-2003-Errors.xls
Attached Files
File Type: zip book1.zip (9.6 KB, 183 views)

Reply With Quote
  #18  
Old October 27th, 2003, 11:33 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,176 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 42 m 4 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
wow... Jo.. you're still pounding away, huh. If you'll send me your code, I'll see if I can work through it.
__________________
Fisherman

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein

Reply With Quote
  #19  
Old October 28th, 2003, 12:54 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
I find u writed incorrently:
On Userform1:
Private Sub Command1_Click()
Dim Email As stirng

should be:
Private Sub CommandButton1_Click()
Dim Email As String

And in the GetEmail Function,u should declare MyString variable.

It's my found..Hope it's helpful..

Reply With Quote
  #20  
Old October 28th, 2003, 05:38 PM
josephg josephg is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: sydney
Posts: 47 josephg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 2 m 32 sec
Reputation Power: 5
I am still pounding away, and I will not rest until it is completed
without U for me was a dream to be here

I have changed line as U recommended to
Private Sub CommandButton1_Click()

Now when I click the button I get User-defined type not defined

I have checked tools>References
I am using MS Forms 2.0 Object library

Also you have mentioned
" in the GetEmail Function,u should declare MyString variable"
Could you please show me how to in previous codes

Last edited by josephg : October 28th, 2003 at 05:41 PM.

Reply With Quote
  #21  
Old October 28th, 2003, 08:10 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
I can run your code that i modified in my pc..And i haven't get the error "User-defined type not defined "..U have vb develope environment or office develope environment??
If u have,U shouldn't get this error..

Reply With Quote
  #22  
Old October 28th, 2003, 09:40 PM
josephg josephg is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: sydney
Posts: 47 josephg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 2 m 32 sec
Reputation Power: 5
I do not know what do you mean by
VB develope environment or office develope environment??

I am using ms office2000 professional edition, Excel2000, then i use tools> macro > to edit or crate macro or forms as I have mentioned before I am using microsoft Form 2.0 object library

??????

Reply With Quote
  #23  
Old October 29th, 2003, 12:48 AM
Unkie Unkie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 32 Unkie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m 27 sec
Reputation Power: 5
you might want to try and add microsoft office 8.0 and visual basic for appllications + OLE automation to your references.

Reply With Quote
  #24  
Old October 29th, 2003, 12:53 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
ACC2000: VBA Functions Break in Database with Missing References
This article was previously published under Q208218
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

For a Microsoft Access 97 version of this article, see 160870.
For a Microsoft Access 2002 version of this article, see 283806.

SYMPTOMS
If you have a procedure that contains a Visual Basic for Applications function, and your database contains a reference to a missing object library or type library, you may receive the following error message when you compile your modules or run the procedure:

Compile Error:
Can't find project or library
CAUSE
Your database contains a reference to a database, type library, or object library that is marked as MISSING: <referencename> in the References dialog box.
RESOLUTION
To remove the missing reference, follow these steps:
Open your database.
Press ALT+F11 to switch to the Visual Basic Editor.
Open a module in Design view.
On the Tools menu, click References.
Click to clear the check box for the type library or object library marked as MISSING: <referencename>.
An alternative to removing the reference is to restore the referenced file to the path specified in the References dialog box. If the referenced file is in a new location, clear the MISSING: <referencename> reference and create a new reference to the file in its new folder.

NOTE: In an Access run-time application, you cannot view references from a menu. However, the following article demonstrates how to view references by using code:

209849 ACC2000: How to Loop Through References to View Their Properties


MORE INFORMATION
Steps to Reproduce Behavior
Open the sample database Northwind.mdb.
Create a new form.
On the Insert menu, click ActiveX Control.
In the Select an Activex control list, click Microsoft Forms 2.0 ToggleButton, and then click OK.
Save the form as frmReference, and then close it.
Close Northwind.mdb and quit Access.
Find and rename the Fm20.dll file to Fm20.xxx.
Start Access and open Northwind.mdb.
Open the module named Startup in Design view.
On the Debug menu, click Compile Northwind. Note that you receive the error message described in the "Symptoms" section.
Click OK. Note that the References dialog box appears; the following reference is highlighted in the Available References box:MISSING: Microsoft Forms 2.0 Object Library

Click Cancel in the Available References dialog box.
Find and rename the Fm20.xxx file to Fm20.dll.
Repeat step 10 and note that the error message no longer appears.

http://support.microsoft.com/defaul...&NoWebContent=1

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > How to send mail from VB to multiple users


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway