Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Saving Selected Mails As Text File In Specified Folder


Hello pple, i am new to vba programming and i will appreciate any help, links or codes regarding this.
thanx alot!

A macro in OutLook 2000 that is able to:
1: check the number of currently selected mail items,
2: convert each selected mail into a text file,
3: check if there is any attachment in any of these mails
4: save the created txt files and attachments found into a specified folder in windows.




Edited by - ahfeng on 1/27/2004 1:44:36 AM




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Saving Selected Items From A Listbox To A Text File
Hi folks,

I can use the following code to save the entire contents of a listbox to a text file, but I can't work out how to just save the selected items (I have multiselect set to 2).

Any ideas?

Simon

Dim file As String
file = "temp.dat"

On Error Resume Next
Open file For Output As #1
For i = 0 To lstWorkstations.ListCount - 1
a$ = lstWorkstations.List(i)
Print #1, a$
Next
Close #1

Saving Outlook Received Mails To Access Or File
I can't seem to find a namespace or the appropriate objects to copy my outlook emails to a file access or even SQL DB. HAs anyone done that?



Mike
eLawman
www.eLawman.com

Saving Items (selected Items) In List Box To A Text File
I need help in coding the following:

1. Saving (or exporting) the items displayed in List Box to a text file.

2. I have a long list of data to be displayed. When I use this List box all of my data does not fit into the width. I was wondering if there is similar other way where I can do horizontal as well as vertical scrolling. I tried text box and its of no help i guess.

Open Folder With Selected File
Hi. I want to open the Windows Explorer with one file selected. I've tried this

Code:
'...
Shell ("explorer.exe" & file)
'...

Well, this doesn't work.
Need help. Thank's

Has User Selected A File Or A Folder
Dear All,


strSelection = "C:dataxyz"

The above string contains a path. How can I check that whether xyz is a file or a folder?

Please help and guide.

Saving Of Multiple Selected Xls Into Csv File
Is it possible to save multiple selected excel file into .csv file in VBA using filelistbox selection?

Thanks...

Show A Folder Using Explorer With A Particualr File Selected.
Hi

Given a full file path (i.e "C:TEST.txt") i want to display the folder the file is in with windows explorer and i want TEST.txt highlighted or selected within that folder.

I am able to shell the folder using shell or shellexecute but i can't select the file.

Any ideas on how to do this?

Thanks
Shane

(Im not sure if i posted in the correct forum)

How Can I Send Win Explorers Selected File/folder List To Myprogram
i want to sent the list of selected file/folder from windows explorer

to my program

i've tried it by sending it through command line but every time it

opens a new instance of my program. and when i prevented it from

openning no more than one instance than its getting only one item

from explorer through command line.

[to send command line argumnt i first did some manupulation into

registry to appear my programs name into windows explorer right click

menu than. right click on any file and click "send it's name to

program"]


plz see the attacment picture to understand my question.
(shown in attachement : untilteld1.jpg)

How Can I Send Win Explorers Selected File/folder List To Myprogram Using Commandline
i want to sent the list of selected file/folder from windows explorer to my program

i've tried it by sending it through command line but every time it opens a new instance of my program. and when i prevented it from openning no more than one instance than its getting only one item from explorer through command line.

[to send command line argumnt i first did some manupulation into registry to appear my programs name into windows explorer right click menu than. right click on any file and click "send it's name to program"]

Saving Folder Without File Name!
I am using common dialog control to allow a user to choose where he wants to save a file. However the user is not suppose to be able to name the file just choose the folder but in the open/save window that appears it allows the user to type a name. The question is therefore whether there is a way to just allow the user to choose the folder and allow the program to name the file.

Saving E-mails In Word Using VB6
Hello,

I have lots of e-mails and I would like to save them as follows in word document using VB6.  I want that VB6 should save all the e-mails in the designated word file.

The word document should contain

From: XXXX@XX.com.au
Date: XX-XXX-XXXX
To: XXXX@XX.com.XX
Subject: XXXXXXXXXXXXXXXXXX
Message: XXXXXXXXXXXXXXXXXXXXXXX

I am using outlook as the e-mail program.

Moving Or Saving A .mdb File To Another Folder Code
eiy guys,, i need a code that will move or save as my database.mdb
located on C:

and move it to D:/backup/

please give me the code and the proper preferences to click

please email me at pwedepobangmagtanong@yahoo.com

How To Choose A Default Folder For Saving A File
I'm currently printing excel, powerpoint, and text files to the PDF Writer. This results in a new pdf being created. For each print the user is given a pop-up and asked where to save the pdf. How can I set the default folder where the pdf will be saved to?

Thank you.
Tiffany

VBA HELP! Saving Outlook E-Mails To .txt Files
I am trying to use VBA to save the body's of all the emails in a particular sub-folder to a directory on my hard-drive. When I run my code I recieve the following error

Run-Time Error - '2147467259 (80004005)':

Internal Application Error



Here is the code that I am using. Any help would be greatly appreciated.

Public Sub SaveIt()

Dim objMapiName As Outlook.NameSpace
Set myOlApp = CreateObject("Outlook.Application")
Set objMapiName = myOlApp.GetNamespace("MAPI")

Set folder = objMapiName.GetDefaultFolder(olFolderInbox)
Set subfolder = folder.Folders("TOP OPEC")

For i = 1 To subfolder.Items.Count

Set myItem = subfolder.Items.Item(i)

myItem.SaveAs "C:TOP OPEC" & myItem.Subject & ".txt", olTXT


Next

End Sub



Rollin

Saving Multiple E-mails [SOLVED, Thank You]
How do you save multiple E-mails?

Saving Mails And Attechments By MAPI...
I tried the source code "VBMAPI" of MSDN...but its only for the viewing the mails...
for outlook express...

I also want to save the mails and attechments through it.
What code should be added in exsisting VBMAPI code of MSDN..or any other mathods for the same..any other idead or suggestions...

How To Move The Read Mails To Different Folder From POP3Account
Hello all,

This is anil. I am doing my project in bangalore.

I have downloaded the MailChecker source.
Using this i can read and delete the Mails.

But i want to Move the Read Mails from Inbox to Other Folder.

Is there any way to do this.

please keep a copy to this iloveuanil@hotmail.com

Thanks in advance.


Anil Kumar

How To Save Mails In A Different Folder Instead Of Drafts In Outlook
hi
i have written an automailr code using mapi control. but problem is that i want to save this mails in a different folder in stead of drafts folder using vb. sorry i have forgotten to mention, i am using outlook exp.
so pls help me....
its very urgent
awaiting...
sumit
snandiroy@yahoo.com

Saving Then Printing MP3/CD Folder/file Names In A List
Hiya

I am a 17 year old student from the uk

this isn't a project i have been given from school (i have just read the rules thingy.....but don't think i am just trying to get ya help for a project and cheat)

I'll try and explain

basically i have a collection of encoded MP3's that i have got from my CD's, and have burnt them onto mini CD's to play in my MP3 player

my mp3 player doesn't support file names, and so all i get is numbers. With mini cdr's holding approx 40/50 songs, and have numerous of these little CD's, i loose track of what is on what.

I would like to create a program that pulls off file names from the cds and puts them in order, much like explorer does (although explorer has file names and folder names in different sections, so i unfortunately cannot simply print screen)

folder 1 name
- file 1 name
- file 2 name
- and so on
folder 2 name
- file 1 name
- file 2 name
- etc

i would like it put it into a text file or other similar way to make it printable

any help would be greatly appreciated

i have looked on the net already but can't find a ready made program which will do the task as i wish it.

i asked my comp studies teacher and he said he couldn't work out how to do it..but he knows what he means (great help obviously)

thanks in advance for any help i recieve...i am afraid i have a very basic knowledge of programming

ta

Skywalker
Skywalker2000_uk@hotmail.com (i have MSN messenger)
ICQ# 36240843

Read Mails From The Inbox Folder Of Outlook Express
hi,
i want to know how to read mails from the inbox folder of outlook express and not microsoft outlook.
i was able to do with micorsoft outlook but unable to do with outlook express.

Browse For Folder That Remembers Last Folder Selected
Hi There,

I need a browse for folder code that "remembers" the last folder selected. Like this, whenever the program is run again, it starts browsing from the previously selected folder.

I've been struggling with this for a long time. Can anybody help me?

Thanks in advance,

Tamosai

Selected Text File
Just a tad confused on this part. I have a Text File which saves all the information entered in every single Text Box.

I thought I would keep it neat by adding little 'Headings' so when a user opens it, they can see exactly what information is what.

I use the following example code to save a 'Heading' before the contents of a Text Box:


Code:
Private Sub cmdSave_Click()

On Error GoTo ErrHandler
CommonDialog1.Filter = "All Files (*.*)|*.*|Text Files (*.txt|*.txt|Batch files (*.bat)|*.bat"
CommonDialog1.FilterIndex = 2
CommonDialog1.ShowSave
Filename = CommonDialog1.Filename
F = FreeFile
Open Filename For Output As #F
Print #F, "TextBox 1: " Text1.Text
Print #F, "TextBox 2: " Text2.Text
Close #F
ErrHandler:

End Sub
This does exactly what I want to do. So when I open the Text File it looks something like this:

TextBox1: Testing TextBox 1
TextBox 2: Testing TextBox2

The only problems I get is when I want to load the file. I use the following code to load each line into their corresponding TextBox:


Code:
Private Sub cmdLoad_Click()

Dim strLine As String

On Error GoTo ErrHandler
CommonDialog1.Filter = "All Files (*.*)|*.*|Text Files(*.txt)|*.txt|Batch files (*.bat)|*.bat"
CommonDialog1.FilterIndex = 2
CommonDialog1.ShowOpen
Filename = CommonDialog1.Filename
F = FreeFile
Open Filename For Input As #F

Line Input #F, strLine
Text1.Text = strLine
Line Input #F, strLine
Text2.Text = strLine

Close #F
ErrHandler:

End Sub
Only problem is, instead of getting 'Testing TextBox 1' & 'Testing TextBox 2' I get 'TextBox1: Testing TextBox 1' & 'TextBox 2: Testing TextBox2'

Is there a way to 'select' specific parts of a Text File when loading it into a VB6 application?

Rewrite Text In Selected File
I have a program that is supposed to rewrite text in a selected file.

I was trying to assign the file to a file number (#1) and open the file for output, the problem is that all it does is delete the text then rewrite the entire file.

What I really want to do is open the file as it is and if a certain string exists then I want to overlay the string with a replacement string then save the file.
(As an example - if an item has been assigned a replacement value and that value has changed, how can I change the value programatically. I know that I can do this by opening the file through edit mode is a program, but I want the program to search the file and find all occurances of the value or string and make the changes without manually going through each record).

Should I be opening the file for Input and then massage the data ?
Is that possible to do in VB ?
-or-
is there a different way to do this.

I can parse through the file to find the selected text, but with "Open for Output" there is no data to parse.

Can anyone point me in the right direction on this one or give me any ideas that will make this text replacement possible.

Thank you,

Jennifer

Take Selected Lines From Text File
Hello All,

Can anyone please help me how to fetch the selected line from text files.

I have a text file and it contains 20 to 25 rows. All files have shuffled lines.
Name=2525152.TXT
Size=1086396
Job=2525152
Original Job=2525152
JOB Time=2/14/2008 10:27:06 AM
Length=288
ID=99915
Subject=
Location=23
Name=Work
Time=2/14/2008 10:27:06 AM
Type=9306
Code=1
Account=1
Department=0
User=0
User=0
User=0
User=0
Pending=0
Request=0

Now i need the following fields in seperate text file
Subject=
Name=
JOB Time=
type=
Department=
Account=

Show The File Selected With Browsing In The Text Box.
How can I make the browse button to select the Input and/or Output file,
so that when the file is selected you can see the full path with filename
in the text box near the browse button?

Thanks

RichTextBox - Save Selected Text To File
I thought this would be easy ... but ...

I want to select some text from a RichTextBox control, and then click a command button to save the selected text to a file. Es posible ?

Folder List Box>>Selected Folder?
In a folder list box, how would I get the the name of the selected folder?
I just want the name of the selected (Highlighted) folder and not the whole path.

Dir1.selected 'does nothing was worth a shot but.
Dir1.path 'gives too much info

Any help is appreciated!

Sorting Data From An ASCII Text String And Saving It As Text File
Hi,
I'd first like to copy paste a section of my ASCII text string over here and then ask the question.Given below is the ASCII text string:

RT 01 A_UNIT
DEV 01 A_UNIT

=ontrol Mode ON LOCAL STAT
Occupied YES OCC
CCN Chiller START CHIL_S_S
Alarm State Normal ALM
Active Demand Limit 100 % DEM_LIM
Override Modes in Effect YES MODE
=
=?
RT 01 CIRCA_AN
DEV 01 CIRCA_AN

=IRCUIT A ANALOG VALUES
Percent Total Capacity 100 % CAPA_T
Percent Available Cap. 100 % CAPA_A
Circuit Running Current 185 AMPS A_CURR
Discharge Gas Temp - A2 122.9 dF DISTMPA2
Saturated Condensing Tmp 97.5 dF TMP_SCTA
Saturated Suction Temp 41.5 dF TMP_SSTA
EXV % Open 43 % EXV_A
Variable Head Press Pct. 0 % VHPA
=
=?

Given above is a portion of my ASCII text string.I'd like to know how to sort out the data from this file and copy it in the same format as given above into a new Text File,using the delimiting characters like the white space and the "?".The "?" indicates the end of the file and the following ASCII text string after every "?" indicates the start of a new text file.

I'd be very very grateful to the person who'd give me the solution to this.Thanking you in anticipation.

Copying Selected Number Of Lines From Text File
Hello,
I'm a little new to VB, using it most of the time to run small macros in excel.
I have a text file with around 90000 rows. I need to copy 65000 of these rows into one sheet and the remainder into another sheet of the same workbook.
I tried using the OpenText() method of the Workbook class but wasn't able to get what I wanted.
Can anyone help with with this?? I couldn't find a similar post in this forum. Help gladly appreciated.

Data Grid Record Selected Or Cell Text Selected?
Does anyone know how I can differentiate programmatically between a record being selected on a datagrid via the record selector arrow to the left of the grid so that the whole row is highlighted, and a cell within a row being selected.
I want to allow the user to delete the row but not delete inside a single cell.

Cheers

Saving Text Of Mulitple Text Boxes To Txt File
I have a form with multiple text boxes that need to be filled out. I want the content of each of the text boxes to save into one text file on the local pc.

How would I do this.

Grabbing Text From A Text File And Saving As A String...
Hello everyone! Just a quick question...I have the following text file that I would like to grab the score from each hole, the par for each hole, the yards from each hole, the handicap from each hole, the player name, the course played, the tees played, the conditions played...basically everything as it's own string. How would I go about doing this?

Attached is the text file (it doesn't word wrap though...it does have carriage returns though):


Thanks in advance!

Dave Mosher

Import Selected Rows From A Comma Delimited Text File Into Excel
I would like to import specific rows and specific values from a large comma delimited file.

For example, if the file was:

baseball, cardinals, st. louis, championship
football, rams, st. louis, championship
football, bears, chicago, championship
baseball, scrubs, chicago, loosers

I would like to import just the rows with "baseball" and only bring in the 2nd and 3rd "columns". File contains 25-30K rows. I want to bring these into a worksheet.

Crystal Report - Export Selected Page Range To Text File. Please Help.
Hi!

I'm using CR 8.5 & VB6.
I have a multiple pages (19 pages) crystal report previewed within my vb application.
Exporting this report to text file is quiet possible as far as i know but is it possible to export this report with the defined page range? Shall i say export page 10 to 19 only, is it possible?

Please help.

Or any suggestions please...

Thanks in advance!

Saving Text Box Output To A Text File
Ok Guys,

well I am getting there slowly and ive finally figured how to save text box output to file but ive got a problem:

Dim data As String

data = Text1.Text
Open "reminders.txt" For Output As #1
Print #1, data
Close #1

The thing is now that there is more than one text box that needs to save to the file and i want it so that each time someone clicks it makes a new record. What do i change or add to the code to make it create a new record by itself. I want all of the info from the text boxes and combo boxes to be one record and saved as one record once the save button is pressed. Then the next time its pressed i want it to save to a new record.

Saving To Text File From Filename In Text Box
i am trying to save to a txt file that is the name inside a textbox so the user types the name of the file and it will eaither write to that file or create and write to that file i will also need it to be formatted in the txt file so like this

line 1:monday
line 2: monday_text
line3: tuesday
line4:tuesday_text ETC

if you could show me some code that would help me or icq me or somthing i would be greatfull

Getting And Saving Text In A .txt File
I know this is pretty easy, I can write and recieve text from a .txt file, the only problem I have is when it comes to putting more then one string in or taking them out... What I mean is this...

I have two listboxes, when the program opens it checks for a .txt file with App.Path & whatever the filename is (I can get this part fine)... It then needs to take the information in the .txt file and put it in the listboxes (I'm not sure how to take this information from the file)... The thing is, if there isn't a .txt file, I just want it to do nothing...

This file's text, when opened would look like this:
"List1 Information", "List2 Information"

I'm not sure how to bring this information into the program and send it to the listboxes, I'm thinking something along the lines of...



Code:
Dim intFreeFile as Integer
Dim List1Info as String
Dim List2Info as String
intFreeFile = FreeFile

Open App.Path & "Hello.txt" For Input As #intFreeFile 'If the file isn't here, should I have an On Error Goto statement to just Exit Sub? I do not have anything below this open statement, so there would not be any code lost because of exiting the sub...
Input #intFreeFile, List1Info, List2Info 'I need a line input right? If I want this to go one set of items at a time?

Do while not EOF(intFreeFile)
List1.additem List1Info
List2.additem List2Info
loop
Also, when the program closes, I need it to delete the old .txt file then write listbox1's and listbox2's info into the .txt file (this is done with append if I'm not mistaken since the file wouldn't exist, correct?).

So something like...


Code:
Private Sub Form_Unload(Cancel As Integer)
Kill App.Path & "Hello.txt" 'If this file did not exist in the first place, what should I do to deal with the error recieved telling me it does not exist?

Dim intFreeFile as Integer
Dim List1Info as String
Dim List2Info as String

'Here is a problem though, I don't know how to enter it line by line and make it go down the lists until it gets to the end.

intFreeFile = FreeFile
Open App.Path & "Hello.txt" For Append As #intFreeFile
Write #intFreeFile, List1Info, List2Info
Close #intFreeFile
End Sub
I wrote most of the code, please don't give me the run around just telling me what I should use, please give me an example of what you mean, it helps much more then having to find other examples that are often wrong or wouldn't help in this certain case (Sorry, I've just seen some REALLY bad answers to some problems lately). I know I have no room to talk, I'm very much a VB beginner, and all help from ANYONE is much appreciated! THANKS EVERYONE! (Sorry if this sounds like flamming, it's not! Honest! )

Saving To A Text File
Im trying to save my program to a text file but soesnt seem to be working.

for example:

For i = 0 To Text1.Text - 1
A(i) = Text1.Text(i)
Next i
ItemCount = Text1.Text
Open "h: empname1.txt" For Output As #1
For i = 0 To ItemCount = 1
Write #1, A(i)
Next i
Close #1

anybody got any suggestions of how to get it working?

Saving Text File
hi,

i always thought that the only way you could save a string or some text was by using a database. can you save it just by saving it in texfile format (.txt)??

thank you kindly

adam

Saving To A Text File
In the game I am creating I would like to be able at the end of it to be able to save the users name to a text file. And every time the game is run if the save button is pressed then a new text file is created to hold this name.

At the moment, for another part of my program, I have the code,


Code:
'creates file in my documents
Open "c:My documentsUsername.txt" For Output As #1
Close #1

'puts the variable Username into the text file
Open "c:My documentsUsername.txt" For Output As #1
Print #1, Username
Close #1
When I load up the program, if I quit it, I can see what is in the file with the code,


Code:
'Shows the name of the last user to play the game
Open "c:My documentsUsername.txt" For Input As #1
Input #1, Username
lblLastUser.Caption = "The last person to play this game was " & Username
Close #1
Can someone tell me how i would addapt this code so that each time the save button is pressed it creates a new file holding the users name.

Umm Help {Saving Text File}
first time i have used vb 6 and i just wantd to make a basic text program like notepad but more basic so i added a text box and then a button and i askd my friend how to save the text within the text box and he said but this into the button

Private Sub Command1_Click()
On Error Resume Next
Open App.Path & "/file.txt" For Input As #2
Line Input #2, Text1.Text
Close #2
End Sub

and i did, and it just errors and wont let me compile it says this error message

variable required - cant assign to this expression

and highlights the .Text in the Line Input #2 line

so i havnt a clue wat went wrong but there u go :P any be very helpful thx

Saving To A Text File
It's not working for me, the reading part, I have it so it write's to the file, I opened the file and looked, it's already there, now when I try to read it it's not there, this is what I have:


Code:
Dim objListItem As ListItem
Dim TagInfo As New clsTag
Dim fso As New FileSystemObject
Dim fldr As Folder
Dim f As File

With TagInfo
If .IsValidTag Then
Open "C:playlist.txt" For Input As #1
Dim sinfo As String
Set objListItem = lstmp3.ListItems.Add
Line Input #1, sinfo
objListItem.Text = sinfo
objListItem.SubItems(1) = sinfo
objListItem.SubItems(2) = sinfo
objListItem.SubItems(3) = sinfo
objListItem.SubItems(4) = sinfo
End If
End With
Close #1

Saving To A Text File
I am trying to save stats like Hits, attack, and gold to a text pad file then load them into labels on the game. Could anyone tell me how to accomplish that...
... oh look the bells gonna ring finsish this later at home.

Saving Text To An .ini File.
Can anyone help with the following? I'm as green as green can be to VB.. as in 1 week now. I'm loving it.. but, oh... so much to learn. I did a search before asking the following.. but I can't find anything that allows me to do just this. Some tuts show similar ideas.. but seem to have a lot more going on. I'm trying to break things down to the simplest level. It helps me understand more easily.

I just want 1 text box (or list box?) and 1 command button on a form. I want to be able to type a word in the box.. and hit my command button to save the word to an .ini file. That's it! Thanks for any suggestions/help in advance!
jk

Saving Into A Text File
Hi to everybody!

Somebody know my engine called LSFTF (Loading Strings From Text File)(The download of the engine is avaible at this forum).
But now I want to revert it.In time to load strings from a text file I want to save into a text file.See the post with the engine.

Somebody could give me the code for perform that job?

Saving To A Text File
Hi guys,

I need to know how i can save the value of a label so that the next time i load up the program the value will be the same.

I was told to save the value to a text file, can anyone show me how to do this, or do you have any other way of doing it?

Thanks guys.

Saving A Text Box To A File
Can any one tell me how to out put what is in a text box to some type of file(.txt, .html,...)

Thank you in advance

Saving To Text File
Hey guys I'm pretty new to VB but I know my way around pretty well.

I'm trying to make a program with a few text fields and when you save it, it all saves to a text file. I know how to get the save as dialog box to apear, but i don't know how to actually save it to a text file.

Please help me, if you're going to post code, make it really simple, I just want the most basic way to do it

Thanks, Puffs.

Saving To Text File
Please can someone help i need to save info to a text file cause enduser has no db, but it also needs to be queried and altered. Please can anyone help me with the actual string to save to text file as well as how quering would work. Thanks btt.

Copyright © 2005-08 www.BigResource.com, All rights reserved