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



What is this flags used for?
What are the different values that can be passed to it(flags).?
When I save it to a txt file I could see additional text
like information of Font type,size etc.How do I save the
text in the RTF as a clear text file void of such info?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Problem With RichTextBox1.SaveFile Method
The text I want to save is inside the textbox. This function is supposed to save the text in (rtf?) format to C:GitmailMessage Text.rtf. The file saves ok, however, when I open it, there's nothing inside. I also tried saving to a text file in plain text format, but that gives me a bunch of garbage.

rtbMessageText.SaveFile App.Path & "Message Text.rtf", rtfText

I also tried their numerical equivalents (0 for rtfText and 1 for rtfRTF, if I remember correctly) and got the same results.

RichTextBox1.SaveFile App.Path & &"SSnp.rtf&", RtfRTF
RichTextBox1.SaveFile App.Path & "SSnp.rtf", rtfRTF Saves as rtf vbut i wana save ti as .conf file hwo woudl i do

how can i add a background to a richtextbox? i know how to add images/pictures, i checked elitevb and garett wrote a tutorial on how to subclass a listbox to add a background but thats no good because i need to subclass a richtextbox

any help would be great!

Okay, here's the code:

Call SavePicture(Picture1.Picture, "C:windowsdesktopIcon.ico)

Picture1.picture does contain a picture, and i don't know what is wrong with it? Please help.

SaveFile As PDF

I recently found coding on your site that saves a MS Access file to .pdf and then emails it using MS Outlook (see FAQ703-2533).  I have attempted to run my code and keep receiving this MsgBox error "User-defined type not defined" at line:
Dim appOutLook As Outlook.Application
See my coding below for the CLICK event.  I'm just learning vb 6.0 and am unsure how to fix this problem.  I may have other coding problems with this CLICK event....haven't gotten that far yet.  Any help is greatly appreciated.  I'm running Office XP with Windows 2000/NT 5.0 environment.  Thanks!

Private Sub cmdPreviewRpt_Click()
On Error GoTo Err_cmdPreviewRpt_Click

    Dim stDocName As String
    Dim Name As String
    Dim appOutLook As Outlook.Application
    Dim MailOutLook As Outlook.MailItem
    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)
    Name = InputBox("Enter the name for the PDF file:", "PDF")
    Call SaveReportAsPDF("rpt_ExpenseRpt", "C:work" & Name & ".pdf")

    With MailOutLook
        .To = "Forms!frmOrder!PEmail"
        .Subject = "mail subject"
        .HTMLBody = "a HTML Body if needed"
        .Attachments.Add "C:Work" & Name & ".pdf", olByValue, 1, "" & Name & ".pdf"
    End With
        stDocName = "rpt_ExpenseRpt"
        DoCmd.OpenReport stDocName, acPreview

        Exit Sub

    MsgBox Err.Description
    Resume Exit_cmdPreviewRpt_Click
End Sub

RTB SaveFile Function
Um, i tried using the SaveFile function to save my txtMain.Text, the save was succesfully without errors, the only problem was the contents of the textfile contained information for font color, background color etc. Is this because i used the SaveFile for saving a standard text file, does it have to be a RTF file in order to use the SaveFile function?


I am using RichTextBox1.OLEObjects.Add to adding smile images to my chat but I am facing problem whenever I call this method it create instance of mspaint object, suppose I am added 50 smile images into my RichTextBox it creates 50 instance of mspaint, these instance are hidden but when u press ctrl+alt+del then see the close program widow where 50 instance of mspaint these instance only removed when chat from unload.

if you have any idea that whenever I call this method it add smile image into RichTextBox without creating a instance of mspaint.

but don't send the copy image to clipboard and paste into RichTextBox.


Richtextbox + Savefile ****
Hello all,

I have a small program that takes information from a database and compiles it to html. I am using a RichTextBox. Now my problem is, after i turned the present text into html, i got good html-text in the rtfbox. But if I know try to save it or anything it takes the makeup commandos from the RTB with it. So i got a lot of code in front and after the htmlpage

ANy idea how to solve this?



Hello. I have a rich text box and I don't want to allow cut and paste in it so I set the .locked property to true. The only problem is that I have some dragging functions for the RTB and setting .locked=true disables the dragging events as well. Is there another way to capture all the cut and paste events (both with control keys, shift keys and right mouse) without setting .locked to true? Thanks

OpenFile And SaveFile
Hi. I'm doing a questionnaire in VB and need the user to be able to save the questions (and the answers they have given) in a file and re-open it later to answer any questions which haven't been answered. i haven't a clue of the code so somebody help me, please!!!!!

I dont want users typing in the left hand side of a rtb. How do I achieve that. You can do that with the right side with .rightmargin, but there isn't a .leftmargin. So what do I do, or is there actually leftmargin but under a different name?

Text1 Or RichTextBox1?
I just want to make a simple HTML editor using a few features noone else uses to simplify it for me. I have been told to use a RichTextBox instead of a Text Box because if I wanted to set a color to specific types of code it would have to be a RichTextBox. I am just looking for some other opinions, I don't know anything about then and a little about Text Boxes. thanks

SaveFile Method
I want to use SaveFile method in order to save the content of text Box into my local directory.
My code like this:
Text1.SaveFile("c:Tempforwei", 1)

The compiler keep giving me error. It can't save the content at all.

Any help will appreciated.


RichTextBox1 Selection Like Text1
Is it possible to make the same "selection type" as a textbox within a rich text box?

Sometimes, if I double click the Rich text box it will get one single byte selected at the end of the text string.

Reading A Txt (text1 Or Richtextbox1)
When I read a txt file with a Textbox it has quotation around the text (i.e. "Hello World", instead of just Hello World)

When I read a txt file with a Richtextbox it looks like a bunch of gooblygook, (i've never used RTB before.

What I need is to get rid of the " " around the text with the textbox or make the richtextbox work and not have " "

Hope that makes sense,



Open "c:myfile.txt" For Input As #1
Text1 = Input$(LOF(1), #1)
Close #1

Help With RTB Savefile Text Formatting
The following codes works except that the text now has formatting info like {
tf1ansideff0{fonttbl{f0fnilfcharset0 MS Sans Serif;}}, /par and /tab all thru.

Is there a way to prevent this or a way to go about the replace function without using an RTB.

VB Code:
Private Sub Command1_Click()     RichTextBox1.LoadFile ("c:gpl_ai.txt")    a = "npt_override = 1.04"    b = Replace(RichTextBox1.Text, a, "npt_override = 1.08")    RichTextBox1.Text = b    RichTextBox1.SaveFile ("c:gpl_ai.txt") End Sub

Cheers, Jack

Savefile Or Text Parse
i wrote a code that communicates through a serial port and receives data as "lf99 9999" (without the quotes) and i do a text.seltext = text1.txt and a text.savefile rtftext .
now but when i open the file in notepad it doesnt look right it goes from left to right


lf99 99999    lf99 99999

how can i get it to save the file like so ..

lf99 99999
lf99 99999

i tried putting a vbcr after the text.seltext = text1.txt but it didnt work


Question, Seltext And Savefile
hello , i have a working code that worked fine until we installed some service packs for windows 2000 pro . this is my issue ...

as400.SelText = sendq8.Text    (this line of code suppose to copy the text to another text sure everyone here knows that

the data looks like this ...


When i do ...

as400.SaveFile "c:LOGSas400q.log", rtfText

the file looks the same as above . but after the SP's were installed , the saved file now looks like this ...

TEST1    TEST2    TEST3    TEST4

The code hasnt changed since 2001 .. not sure whats causing the saved file to be formatted differently. If i open the file in WORDPAD its perfect but in NOTEPAD its wrong.
I feel like the answer to this issue is so simple but its not clicking.


Richtextbox1 Print - Actual View

I have this weird situation. The richtextbox1 prints fine, but the actual screen doesn’t show me the exact margins as the printed form. The form is 8.5X11 and the margins are:

Left:1.25” =1840 twips
Right1.25” =1840
Top:1” =1440
Bottom:1” =1440

' Tell the RTF to base it's display off of the printer
Call WYSIWYG_RTF(RichTextBox1, AnInch + 400, AnInch + 400, AnInch, AnInch, PrintableWidth, PrintableHeight) '1440 Twips=1 Inch

When I copy a DOC / page from Word to my program then it looks not the same. However, when I print the doc using the richtextbox1 the printed form is identical to the Word Doc. Any help?

Why Does It Save This Junk When I Use RTB1.SaveFile
Hi, I was experimenting with the common dialog 6.0 tutorial posted by Mike ( i think) and I kept getting this in my text file:

tf1ansiansicpg1252deff0{fonttbl{f0fnilfcharset0 MS Sans Serif;}}
viewkind4uc1pardlang1033f0fs17 Why is it adding this junk?
par }

As you can see: "Why is it adding this junk" was the original text. Is there a way to avoid this? Thx!

This is my code:

Private Sub Test_Click()

On Error GoTo ErrorTracker
With CommonDialog1
.DialogTitle = "Save"
.InitDir = "C:"
.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
End With
RTB1.SaveFile CommonDialog1.FileName
Exit Sub
MsgBox "Error: " & Error
End Sub

P.S. I hope this wasnt the wrong forum to post under..If so please point me to the right forum.

Rich Textbox Savefile Question
i'm making a simple html editor that allows you to insert tags instead of typing them ... i'm using a rich textbox for this so the tags can be a different color ... now when i save the code that i have is this:

txthtm.savefile dlgsave.filename

the dialog box comes up asking for a directory to save and saves it as a "htm" file ... however when i open up the file to view it in IE what i get is the following on the page:

tf1ansiansicpg1252deff0deftab720{fonttbl{f0fswiss MS Sans Serif;}{f1fromanfcharset2 Symbol;}{f2froman Times New Roman;}} {colortbl
ed0green0lue255;} deflang1033pardplainf2fs24cf1 par plainf2fs24cf0 testplainf2fs24cf1 plainf2fs24cf0 par plainf2fs24cf1 plainf2fs24 par }

why does this happen? - can't the file be saved into a proper htm file with the rich textbox ... i know there is some syntax to save as rtfRTF or rtfTEXT but can't it save as HTM ... how does MS WORD give you options to save as a HTM page

Richtextbox1.setfocus On Form_load Displayed An Error? Alternatives?
i want my richtextbox1 be the focus when my program starts. just that

Locating Selected Words In A RichTextBox1 And Changing There SelColor
ok is there a way that once i click on Command1 it will find all the words on my RichTextBox1 from my list1 and change there color to blue?

so if lets said in list1 i got : if, then, end, sub etc.. then in my RichTextBox1 this words will be in blue color

Richtextbox1.text=text1.text With Font Options
what i want is too send text from the textbox to the richtexbox and it be in the font and bold and color i chose . now whats happening is its comming into the richtextbox plain unless i type something frist then it comes in what i set to
heres a look at the code

Private Sub Command1_Click()
RichTextBox1.Text = Text1.Text

End Sub

Private Sub Command2_Click()
End Sub

Private Sub RichTextBox1_Change()
If RichTextBox1.SelStart = 0 Then Exit Sub
RichTextBox1.SelStart = RichTextBox1.SelStart - 1
RichTextBox1.SelLength = 1
RichTextBox1.SelBold = True
RichTextBox1.SelFontSize = 12
RichTextBox1.SelColor = CommonDialog1.Color
RichTextBox1.SelLength = 0
RichTextBox1.SelStart = RichTextBox1.SelStart + 1
RichTextBox1.SelFontSize = 12
RichTextBox1.SelBold = True
RichTextBox1.SelColor = CommonDialog1.Color
End Sub
any help would be appreciated thanks

RichTextBox1.Find (...want To Find More Than One Instance)
I am using a rich textbox. Inside that box I am searching for a particular word. Let's say the word is "up". The sentence is: "Up up and away-ay, in my beautiful balloon."

Here there are 2 instances of up. How do you find both(or all if there were 5 instances of up) using the RichTextBox1.find ("up") statement/code???

My reason for finding this is to color all instances of the find result a certain color. Say red for example. So...up would appear red twice in my rich textbox. This is similiar to how you search help. You know, it gives you every instance of the word that you searched for in green. That's what I'm trying to do.

Any ideas???


<input Type=&"submit&" Name=&"op-savefile&" Value=&"Save&"> - How To S
<input type="submit" name="op-savefile" value="Save"> - How can you submit this button through visual basic in a webbrowser?

Copyright © 2005-08, All rights reserved