Pls tell how i can create Excel sheet in MSFlexgrid & how i write data
2 5826
Are you want to export the data from flexgrid to excel or edit data in flexgrid?
clarify that.......
samy
Pls tell how i can create Excel sheet in MSFlexgrid & how i write data
-
'Pass Flx Grid as Perameter to this Method
-
Public Sub create_csv(flx As MSHFlexGrid)
-
Dim str1 As String
-
Dim PrintFormat As String
-
'Opening a Csv file
-
Open App.Path & "\export.csv" For Output As #1 ' Open file for output.
-
'For loop to the count of Grid Rows
-
For i = 0 To flx.Rows - 1
-
str1 = ""
-
'For loop to the count of Grid Columns
-
For j = 0 To flx.Cols - 1
-
'Passing Grid Col Value to Temp String Variable
-
str1 = str1 & flx.TextMatrix(i, j) & " "
-
If j <> flx.Cols - 1 Then str1 = str1 & ","
-
Next
-
'Printing Grid Row Value to the Opened Csv format File
-
Print #1, str1
-
Next
-
'Closing Csv File
-
Close #1
-
'Passint Grid cols to Format the csv file columns
-
openfile (flx.Cols)
-
End Sub
-
-
Public Sub openfile(thecols As Integer)
-
'Decelar Excel Application
-
Dim objExcel As New Excel.Application
-
Dim objWorkBooks As Object
-
Dim objAsheet As Object
-
'If Error then Creating Latebinding Object
-
If Err.Number Then
-
Err.clear
-
Set objExcel = CreateObject("Excel.Application")
-
End If
-
Set objWorkBooks = objExcel.Workbooks
-
'Opening File
-
objWorkBooks.Open App.Path & "\export.csv", , , 2, , , , , ","
-
'Fit the Col Cells to the length of Data
-
For intCol = 1 To thecols
-
objExcel.Columns(intCol).AutoFormat (2)
-
objExcel.Range("a1", (objExcel.Columns(thecols).AddressLocal) & TheRows).AutoFormat (GridStyle)
-
Next
-
objExcel.Visible = True
-
End Sub
think this will help u
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: MouseHart |
last post by:
I've written a simple program in VB 6.0 to list all my MP3 files. To show
them on the screen I used an MSFlexGrid named TextGrid (which is not
associated with any table or text file) in the following code run by a
button (the files are all in the format "Artist - Name Of Song" in their
directories, which is why the code looks for a dash):
Private Sub Command1_Click()
Dim dashplace%, length%
For I% = 0 To File1.ListCount
FLIName =...
|
by: Ed |
last post by:
Hi,
I am using an MSflexgrid in my c# code.
I have a strange problem. My MSflexgrid has only 1 column.
Now the data in that column can be long. WIth just 1 column the MSflexgrid
does not show the horizontal scrollbar even if i set the
ScrollBars setting at 3(Both).
If I add 6-7 columns then the horz scroll bar appears.
I am using .NET 1.1 framework
|
by: PVS |
last post by:
Hi,
I am new to VC++ 7.0.
I want to use MSFlexGrid in my dialog based MFC project in VC++ 7.0 (in VS
..NET IDE).
I added the MSFlexGrid control into my resource editor toolbox and I dragged
and dropped that control onto my dialog.
when I tried to assign a variable from my dialog class to this MSFlexGrid
control, it created a class with .h and .cpp files. The new class is
derived from CWnd. I am trying to change it to derive from...
|
by: Martin K |
last post by:
Hello all..thanks for everyone's advice regarding my SHBrowseForFolder
API problem, I was able to put together a public class that runs
great! But I have another migration headache regarding the MSFlexGrid.
I have been able to successfully add a COM object MSFlexGrid in my
VB.Net project. I can successfully populate and manipulate the grid.
But, I have two problems, that I used to be able to do with no issues
in VB 6.
1) AutoSizing...
|
by: Mad Scientist Jr |
last post by:
can someone explain how to simply populate a grid in .net ? the way i
understand it, there is no more msflexgrid, and instead is this new
control that has to be tied to a dataset, and it is a real pain to
work with if you just want to throw some values in a grid and edit
them with a textbox. i don't want to persist anything in a database, i
just need a fast cheap and easy grid in memory that i can work with!
i had functions in vb6 that...
| |
by: schapopa |
last post by:
Hi,
I have a MSFlexGrid control on the SSTab and now I am trying to make it
editable. I got some example on the net that explains how to achive
that. So I have a text box that appears over the MSFlexGrid. It works,
but location of the text box is a little bit off the cell.
(A bit to much to left and to high)
With MSFlexGrid(Index)
txtCellEditor.Location = New Point(SSTab1.Location.X +
TwipsToPixelsX(.CellLeft) + .Location.X,...
|
by: Ben |
last post by:
after I migrated to dotNet, migration wizard transferred over my vb6.0
Msflexgrid activex com as a dll, it putted it in my bin dir as
AxInterop.MSFlexGridLib.dll. however, I can't use this control at all. each
time, I opened up my form layout. I get this message:
"The following exception has occurred:
TargetInvocationException: Unable to get the window handle for the
'AxMSFlexGrid' control. Windowless ActiveX controls are not...
|
by: zoneal |
last post by:
Hi,
I am involved in the process of migrating vb(6.0) application to
vb.net. My application contains only vb controls namely MSFLEXGRID. I
want to migrate my application to vb.net completely without any
OCX(MSFLEXGRID) controls.
I found datagrid to be an equivalent control of MSFLEXGRID in vb.net.
I am unable to find an equivalent method & property of datagrid in
vb.net. Please provide some examples which helps me to migrate the...
|
by: Steven |
last post by:
I develop the application which contains MSFlexGrid to display data. When I
try to fill the grid with the text data, I want to adjust the column width
so that the width is adjusted to the maximum pixel width of the column text
data. I have a function to measure the pixel width of the string data,
however, I found that the parameter of the Set_ColWidth() function in
MSFlexGrid is not in pixel unit. How can I convert the pixel unit to the...
|
by: Ishmael |
last post by:
Hi
Is Been a 3 Yrs Now (I Still trying to do this)
Please help me to do this with Visual Basic 6.0 using Msflexgrid
Let say you are the Principal . You have 10 educators and 5 class (Grades) .So you want to setup a School Time Table for them.
Each educator must go to each period but if that educator go to grade 6 period 1 on Monday. The same educator must do that period 1 on Monday at the same time, Timetable must aloud the same educator...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |