flexgrid save into CSV file

Posted on 2009-05-25
Medium Priority
Last Modified: 2012-05-07

Now I am using VB already search a result and show on the Flexgrid, I just want to Export into csv file ,I need to open a small windows and change the location and name then save into csv or txt file.


Question by:Simon Chen
1 Comment
LVL 13

Accepted Solution

game-master earned 2000 total points
ID: 24469387

good morning!
try sumthing like this...

add commondialog control and command button on your form...

    Private Sub Command1_Click()
    Dim fileName As String
    Dim ctr As Integer
    CommonDialog1.Filter = "All Files (*.*)|*.*|" & _
                           "Text Files (*.txt)|*.txt"
    CommonDialog1.FilterIndex = 2                             ' Specify default filter
    CommonDialog1.DefaultExt = ".txt"
    fileName = Me.CommonDialog1.fileName
    Open fileName For Output As #1
    For ctr = 1 To flexgrid.rows -1
        Print #1,  flexgrid.textmatrix(ctr,0) & ", " &  flexgrid.textmatrix(ctr,1) & ", " &  flexgrid.textmatrix(ctr,2)
    Close #1
msgbox "Finished"
End Sub

'on this sample, i write the 1-3 columns of the flexgrid on the text file...
change the number on column on the specific column you wnat to write...

i hope i can give u idea...


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
No other job is as rewarding and demanding as building an iPhone app is. It is not really in the hands of the developer for the success of an iPhone app. Many factors operate jointly for every iOS application's success in the market.
Starting up a Project
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…

587 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question