473,473 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Excel modify in VB6

89 New Member
Hi all, I have some code to open an Excel file and I can edit the Excel file easily,

Expand|Select|Wrap|Line Numbers
  1. Dim xlapp As excel.Application
  2. Dim xlbook As excel.WorkBook
  3. Dim xlsheet As excel.WorkSheet
  4.  
  5. Set xlbook = GetObject("d:\TEST.xls")
  6. Set xlapp = xlbook.Parent
  7.  
  8.  
  9. xlapp.Visible = True
  10. xlapp.Windows("TEST.XLS").Visible = True
  11. Set xlsheet = xlbook.Sheets("Sheet1")
  12. xlsheet.Cells(1,1) = "TEXT"
I have some problem with particular case, such as : How i can make Bold of text in the excel sheet, how it is possible to make a table or line,
and change color of text in excel sheet? Thanks a lot 4 your time.
Jan 10 '08 #1
2 4381
MikeTheBike
639 Recognized Expert Contributor
Hi all, I have some code to open an Excel file and I can edit the Excel file easily,

Expand|Select|Wrap|Line Numbers
  1. Dim xlapp As excel.Application
  2. Dim xlbook As excel.WorkBook
  3. Dim xlsheet As excel.WorkSheet
  4.  
  5. Set xlbook = GetObject("d:\TEST.xls")
  6. Set xlapp = xlbook.Parent
  7.  
  8.  
  9. xlapp.Visible = True
  10. xlapp.Windows("TEST.XLS").Visible = True
  11. Set xlsheet = xlbook.Sheets("Sheet1")
  12. xlsheet.Cells(1,1) = "TEXT"
I have some problem with particular case, such as : How i can make Bold of text in the excel sheet, how it is possible to make a table or line,
and change color of text in excel sheet? Thanks a lot 4 your time.
Hi

You need something like this

xlsheet.Cells(1,1) .Font.ColorIndex = 5 'Blue
xlsheet.Cells(1,1) .Font.Bold = True

Hint; The easiest way to find out Excel syntax is to record macros and adapt the resulting code.


MTB
Jan 14 '08 #2
tomarvijay80
10 New Member
Dim xlapp As Excel.Application
Dim xlbook As Excel.WorkBook
Dim xlsheet As Excel.WorkSheet
Set xlbook = GetObject("d:\visual basic\TEST.xls")
Set xlapp = xlbook.Parent
xlapp.Visible = True
xlapp.Windows("TEST.XLS").Visible = True
Set xlsheet = xlbook.Sheets("Sheet1")
xlsheet.Cells(1, 1) = "TEXT"
xlsheet.Cells(1, 1).Font.Bold = True ' Make text bold
xlsheet.Cells(1, 1).Font.ColorIndex = 8 ' Color
xlsheet.Shapes.AddLine(236.25, 217.5, 351#, 291#).Select ' Line




Hope this code will help you.
Jan 15 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jae | last post by:
I'm writing a web application that exports and imports excel files. The application gets a list of users and their info and displays it in a datagrid .The user then selects to save the file as a...
14
by: pmud | last post by:
Hi, I need to use an Excel Sheet in ASP.NET application so that the users can enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever the USER ENETRS needs to go to the...
22
by: Howard Kaikow | last post by:
There's a significant problem in automating Excel from VB .NET. Reminds me of a problem I encountered almost 3 years ago that was caused by the Norton Auntie Virus Office plug-in. Can anybody...
1
by: RickH | last post by:
..Cells(1,y).GetType ownly shows instead of .Value, .Copy, etc. The code below is derived from samples, it should work, but I've messed up somewhere... Imports System.Windows.Forms Imports...
5
by: Scott M. Lyon | last post by:
I've just discovered a bug in some code I wrote a little while ago, and I need you guys' help to fix it. My program imports data from a standard Excel Spreadsheet (just with specific column...
6
by: Mark Rae | last post by:
Hi, My client has asked me to provide a "quick and dirty" way to export the contents of a DataGrid to both Excel for analysis and Word for editing and printing, so I'm investigating client-side...
4
by: Marco Aschwanden | last post by:
Hi I would like to 1. import an existing Excel-sheet (a template) 2. and add some data to it 3. and save it under a different name afterwards. To me it seems, that pyExcelerator does not...
2
by: Mad Scientist Jr | last post by:
>From an asp.net web page I want the user to open the results of a SQL query in Excel, as automatically as possible (ie not having to loop through columns, rows, in code). For this,...
5
by: Rajesh | last post by:
Hi, Please help me to do an EXCEL report generation using ASP.NET. I am building an website. This should work in all machine. I need do load the data from SQL tables to excel sheet and user can...
5
by: tsanthoshk | last post by:
Hi All I am trying to read and modify input excel file. when i update the data in excel sheet already existing format is washing out. It mean if excel sheet contain colors those are not appearing...
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
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,...
1
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...
0
agi2029
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,...
1
isladogs
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...
0
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...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.