473,804 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

remove table border in word from vb

137 New Member
plz urgent help needed
i have one data grid in the form. i have to export the data from the datagrid to the word.
i just exported the data in MS word into a table. but i want to remove the table border. but i am not able to do so till now
can any one help me in this matter
i am using vb6.
TIA
May 3 '07 #1
12 10236
SammyB
807 Recognized Expert Contributor
plz urgent help needed
i have one data grid in the form. i have to export the data from the datagrid to the word.
i just exported the data in MS word into a table. but i want to remove the table border. but i am not able to do so till now
can any one help me in this matter
i am using vb6.
TIA
After Word appears, record a maco that deletes the border, then look at the code and it will show you what objects to use. Your code will be something like
Expand|Select|Wrap|Line Numbers
  1.     oDocument.Tables(1) .Borders(wdBorderTop).LineStyle = wdLineStyleNone
  2.     oDocument.Tables(1) .Borders(wdBorderLeft).LineStyle = wdLineStyleNone
  3.     oDocument.Tables(1) .Borders(wdBorderBottom).LineStyle = wdLineStyleNone
  4.     oDocument.Tables(1) .Borders(wdBorderRight).LineStyle = wdLineStyleNone
  5.     oDocument.Tables(1) .Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone
  6.     oDocument.Tables(1) .Borders(wdBorderVertical).LineStyle = wdLineStyleNone
  7.     oDocument.Tables(1) .Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
  8.     oDocument.Tables(1) .Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
May 3 '07 #2
coolminded
137 New Member
thanx for the suggestion
but it does not work
it doesnot remove the border. it still appears in the table.
i want complete removal of the border
thanx
May 4 '07 #3
SammyB
807 Recognized Expert Contributor
thanx for the suggestion
but it does not work
it doesnot remove the border. it still appears in the table.
i want complete removal of the border
thanx
What does your macro do differently to remove the border? or What do you have to do manually to remove the border? and/or Does my code do anything?
May 4 '07 #4
coolminded
137 New Member
thanx again Sam
it just worked in the print preview. it's okay for now, but now i have another problem, how can i format the text in each column in the table. i want the font size, font and the alignment changed in each column.
can u or anyone suggest for this problem??????

best regards
coolminded
May 8 '07 #5
coolminded
137 New Member
thanx again Sam
it just worked in the print preview. it's okay for now, but now i have another problem, how can i format the text in each column in the table. i want the font size, font and the alignment changed in each column.
can u or anyone suggest me for this problem??????

best regards
coolminded
May 8 '07 #6
SammyB
807 Recognized Expert Contributor
thanx again Sam
it just worked in the print preview. it's okay for now, but now i have another problem, how can i format the text in each column in the table. i want the font size, font and the alignment changed in each column.
can u or anyone suggest me for this problem??????

best regards
coolminded
Use oDoc.Table(1).C ell(1,1).Range and you will find Font.Size, Font.Size, ParagraphFormat , etc. You will have to iterate thru all of the cells. There is a Columns property, but no Range object under that. In Word, everything revolves around the Range object.
May 8 '07 #7
coolminded
137 New Member
sorry to bother u again but the code u provided did not work. coz the cells(1,1) is not allowed and neither other properties like bold, and all other things is allowed, plz help.

following is my code i used to show all the items one by one in each line in word without the border of the table.

plz have a look and plz suggest what should i do to have so, with all the items centered aligned and the size of the font is different for each items with different font name.

Expand|Select|Wrap|Line Numbers
  1. Private Sub command2_click()
  2. Dim oWord As Word.Application
  3. Dim oDoc As Word.Document
  4.  
  5. Dim i As Integer
  6. Dim X
  7. Dim w As Integer
  8.     Set oWord = New Word.Application
  9.     Set oDoc = New Word.Document
  10.  
  11.     oDoc.ActiveWindow.Selection.Tables.Add Range:=oDoc.ActiveWindow.Selection.Range, numrows:=1, numcolumns:=1
  12.     oDoc.ActiveWindow.Selection.FormattedText.AutoFormat
  13.     oDoc.Tables(1).Borders(wdBorderLeft).Visible = False
  14.     oDoc.Tables(1).Borders(wdBorderTop).Visible = False
  15.     oDoc.Tables(1).Borders(wdBorderBottom).Visible = False
  16.     oDoc.Tables(1).Borders(wdBorderRight).Visible = False
  17.     oDoc.Tables(1).Borders(wdBorderHorizontal).Visible = False
  18.     oDoc.Tables(1).Borders(wdBorderDiagonalUp).Visible = False
  19.     oDoc.Tables(1).Borders(wdBorderVertical).Visible = False
  20.     oDoc.Tables(1).Borders(wdBorderDiagonalDown).Visible = False
  21.        i = 0
  22.        w = 0
  23.        For i = 1 To fg.Rows - 1
  24.  
  25.           If w = 0 Then
  26.             w = w + 1
  27.             oDoc.Tables(1).Columns(1).Cells(w).Range.Text = fg.TextMatrix(i, 0)
  28.  
  29.           Else
  30.             w = w + 1
  31.             oDoc.Tables(1).Columns(1).Cells.Add
  32.             oDoc.Tables(1).Columns(1).Width = 500
  33.             oDoc.Tables(1).Columns(1).Cells(w).Range.Text = fg.TextMatrix(i, 0)
  34.           End If
  35.  
  36.           w = w + 1
  37.           oDoc.Tables(1).Columns(1).Cells.Add
  38.           oDoc.Tables(1).Columns(1).Width = 500
  39.           oDoc.Tables(1).Columns(1).Cells(w).Range.InlineShapes.AddPicture FileName:=fg.TextMatrix(i, 3), _
  40.           SaveWithDocument:=True
  41.  
  42.           w = w + 1
  43.           oDoc.Tables(1).Columns(1).Cells.Add
  44.           oDoc.Tables(1).Columns(1).Width = 500
  45.           oDoc.Tables(1).Columns(1).Cells(w).Range.Text = fg.TextMatrix(i, 1)
  46.  
  47.           w = w + 1
  48.           oDoc.Tables(1).Columns(1).Cells.Add
  49.           oDoc.Tables(1).Columns(1).Width = 500
  50.           oDoc.Tables(1).Columns(1).Cells(w).Range.Text = fg.TextMatrix(i, 2)
  51.             Next i
  52.         Unload FrmBar1
  53.     oDoc.ActiveWindow.Document.Close True
  54.     Set oDoc = Nothing
  55.     oWord.Quit False
  56.     Set oWord = Nothing
  57.     Set Db = Nothing
  58. End Sub
again thanx in advance.
May 8 '07 #8
SammyB
807 Recognized Expert Contributor
>coz the cells(1,1) is not allowed
try cell(1,1) without the s
like I posted :)

BTW, You can use .Columns(i).Cel ls(iRow).Font.N ame = "Arial"
this time you use Cells with the s
but your code is strange, don't you want Columns(i) instead of Columns(1)?
May 8 '07 #9
coolminded
137 New Member
>coz the cells(1,1) is not allowed
try cell(1,1) without the s
like I posted :)

BTW, You can use .Columns(i).Cel ls(iRow).Font.N ame = "Arial"
this time you use Cells with the s
but your code is strange, don't you want Columns(i) instead of Columns(1)?
once again thanx
why i use columns(1) instead of columns(i) because i want all the items displayed in a single column. i want to show it as it is displayed in the different line of the word document. but not in a matrix format.

it worked perfectly, i can use the different font name, with different font size,
but now i want to change its alignment. i.e. either left, or right, or center or justified. it doesn't show the alignment property. how can i set the property to center alignment, or right alignment and so on.

can you help me in this matter.
TIA
May 9 '07 #10

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

Similar topics

7
27289
by: wk | last post by:
Hi, I have a seemingly simple html code which has two tables one under another, and both have an image of same size...but the table row also has some text, which seems to be creating a small gap between the two images on display. Can anybody tell me how to remove the thin gap between the two images? <table cellpadding="0" cellspacing="0" border="0"> <tr>
7
1870
by: David Findlay | last post by:
I'm trying to do a table for laying out a links page in CSS. See http://qldstorms.com/links.php. My stylesheet is at http://qldstorms.com/styles/screen.css. My problem is that if the link name in the first column get's word wrapped, but the description text in the second column doesn't, the next row get's wrapped to sit next second line of the link name. Also if a two line link name is last in the category box, it'll cross the outside of...
19
10243
by: Steve Franks | last post by:
I am using VS.NET 2005 beta 2. When I run my project locally using the default ASP.NET Development Web Server it runs using a root address like this: http://localhost:11243/testsite/ However when I deploy to a remote test server running real IIS, the real root of my application becomes: http://localhost/ What I want to do is have it so that on my local machine the asp.net dev
2
1684
by: astarocean | last post by:
using pyparsing to deal with nested tables , wanna keep table's structure and propertys . but program was chunked with the </td> tag of inner table. have any ideas? here's the program from pyparsing import *
5
2122
by: outstretchedarm | last post by:
I'm extremely new to javascript and to programming in general. I am trying to create an interactive table. I have already created the table with constants, in the key of C (it is for music). what I would like to do is to create a dropdown box that would enable the user to select all 12 keys, then based on that choice, have the whole table re-calculate, basically transposing all the data up or down. how would I go about doing this.
6
24584
by: McKirahan | last post by:
I an using ASP to read a database table and generate an HTML table which is save via FSO with a file extension of .xls which opens up in MS-Excel. I am inserting several lines of text into a cell and would like to force a line break between them. I recorded an MS-Excel macro so see how Alt-Enter was captured which turned out to be Chr(10) which is the same as vbLf (right?) I tried inserting that in character in the text but it didn't...
31
3115
by: Sarita | last post by:
Hello, this might sound stupid, but I got a really nice homepage template which unfortunately is a 3-Column Fixed Width CSS format. Now I don't have any content for the right column and would like the middle column just to use up that space instead. Any way this is possible? Thanks for your help, it is highly appreciated!
6
7998
by: Romulo NF | last post by:
Greetings again to everyone, Im back to show this grid componenet i´ve developed. With this grid you can show the data like a normal table, remove the rows that you need, add rows, import data, call determined functions, and edit the data already present What will you need to use the grid? A table with standard markup and an ID to call the script that will turn the table into a grid Parameters: tabelaID => id of the table that will...
0
5480
by: dolittle | last post by:
Hi, I'm embedding a last.fm flash widget. I want to be able to remove it from the page using javascript. I've tried to delete the html element that contains the code but it keeps playing in IE. In FF it stops playing but I can't tell if it is removed or not. Can I do it in javascript or maybe I need a FLASH script to do it?
0
9594
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,...
1
10341
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,...
0
10089
tracyyun
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...
0
9171
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, 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...
1
7634
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 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...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4308
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 we have to send another system
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.