Hello All,
I want to select few rows randomly in the MSFlexGrid and export them to excel using a button which i had made..
already i can send all the record in the grid using my export button bt wht if i want to select few rows randomly and not all and send them to excel sheet?
i knw selectionmode is thr in MSFlexGrid and i can set tht to flexselectionbyrow bt tht doesnt happen for random record...
does anyone can help me in that?
thank u
5 4223
Is this a MSflexgrid in Excel?
Is it possible to attach your program in Bytes so we can work on the same structure and data?
If the data is confidential, please replace it with fictive but representative data.(not to much! ,+- 20 records just to see the structure)
Thank u very much for the reply and helping me here... this is my Grid and the next is my excel button..
once i press on the excel button i can export the whole grid to the excel sheet bt what if i dont want to export the whole data to excel and i want few rows in tht.. for eg. row1,row3 and row7..
how to do tht?
thank u very much in advance -
-
Private Function LoadAddressGridData(FinYrCode As Integer)
-
-
Dim sqlQuery As String
-
sqlQuery = "select PoNo,AmendNo,Yy,Vendornm,convert(VarChar(20), PoDate, 6) As PoDate,UnitNm, adr1 as Address,adrcity as City,statenm as State,"
-
sqlQuery = sqlQuery & "adrpin as Pin,adrcontact as Contact,adrphone as Phone from msaddress adr,"
-
sqlQuery = sqlQuery & "txpohdr hdr, msunits unit,msstates state,"
-
sqlQuery = sqlQuery & "msvendors ven where adrof='U'and adrforid=hdr.unitid"
-
sqlQuery = sqlQuery & " and adrid = hdr.shiptoadrid And hdr.vendorid = Ven.vendorid"
-
sqlQuery = sqlQuery & " And hdr.unitId = unit.unitId And State.stateid = adrstate"
-
sqlQuery = sqlQuery & " And hdr.yy = '" & cmbYear.Text & "' And hdr.Ind = 1"
-
sqlQuery = sqlQuery & " and vendornm='" & cmbVendorNm.Text & "'"
-
-
-
On Error GoTo ChkErr
-
Adodc1.ConnectionString = pStrConnectionString
-
Adodc1.RecordSource = sqlQuery
-
Adodc1.Refresh
-
MSHFlexGrid1.ColWidth(1) = 600
-
MSHFlexGrid1.ColWidth(2) = 800
-
MSHFlexGrid1.ColWidth(3) = 600
-
MSHFlexGrid1.ColWidth(4) = 2000
-
MSHFlexGrid1.ColWidth(5) = 1000
-
MSHFlexGrid1.ColWidth(6) = 2000
-
MSHFlexGrid1.ColWidth(7) = 2500
-
MSHFlexGrid1.ColWidth(8) = 1000
-
MSHFlexGrid1.ColWidth(9) = 1500
-
MSHFlexGrid1.ColWidth(10) = 1500
-
MSHFlexGrid1.ColWidth(11) = 1500
-
MSHFlexGrid1.ColWidth(11) = 1500
-
MSHFlexGrid1.Refresh
-
sortedBy = 1
-
-
Exit Function
-
ChkErr:
-
If Err.Number > 0 Then
-
MsgBox Err.Number & vbNewLine & Err.Description
-
Call ErrHand("frmVendorWiseOrders", "LoadAddressGridData")
-
'Resume Next
-
End If
-
End Function
-
-
My excel code: -
-
Private Sub cmdExport_Click()
-
Dim q As Long
-
Dim p As Long
-
Dim newCell As String
-
Dim xl As Excel.Application
-
If MSHFlexGrid1.Text <> "" Then
-
Set xl = CreateObject("excel.application")
-
xl.Workbooks.Open (App.Path & "\Book1")
-
DoEvents
-
xl.Visible = True
-
-
For p = 0 To MSHFlexGrid1.Rows - 1
-
For q = 0 To MSHFlexGrid1.Cols - 1
-
MSHFlexGrid1.Col = q
-
MSHFlexGrid1.Row = p
-
newCell = Chr(q + 65) & p + 1
-
xl.Worksheets("Sheet1").Range(newCell).Value = MSHFlexGrid1.Text
-
Next
-
Next
-
End If
-
End Sub
-
-
Attached is an example how to randomize some rows in an MSflexgrid in VB6.
I'm working on an example in VBA for Excel 2003.
Attached is an example in Excel.
Thank u very much for ur help.. i got it..
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ABC |
last post by:
What methods can export excel file from stored procedure with parameters
which input from web form?
|
by: khairulfnd |
last post by:
i wanna know the function when u select rows in the datagrid, it will be postback to a gridview
where should i put it
|
by: panku007 |
last post by:
hi All,
I wanted to export excel data into ms word document through
java coding.So please send me reply,according to my question.
thanks
|
by: sladjana21 |
last post by:
Hello, is it possible to select rows form a table, where column with datetime is null,
something like:
SELECT * FROM MYTABLE WHERE DATE_COLUMN = NULL
there is no error, but doesn't return any...
|
by: tbenchakroune |
last post by:
How can I export Excel spreadsheets to Access db?
Thanks,
T.
|
by: san1014 |
last post by:
Hi
How to import and export excel data into oracle database using java.
Thank you
|
by: CF FAN |
last post by:
Can Report Builder Export Excel Files with multiple Sheets
How can I create a report that it can export in excel by multiple
|
by: minhtran |
last post by:
Hi all
Anyone has any idea how to get a Excel header column in VB.NET. Please, help me. Thank you so much in advance
|
by: Dubois |
last post by:
Bonjour
Lorsque je lance un export excel au travert d'une page en ASP.NET C#,
cela fonctionne sur la machine de développement, par contre, sur le serveur
de production j'ai l'erreur suivante :
...
|
by: prashantdixit |
last post by:
Hi,
I am trying to export excel data to text file in a particular format.
The Format for each ROW of Excel is like
IMAN_ROOT/bin/import_file -f=<Column A> -type=<Column B> -d=<Column C>...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |