473,379 Members | 1,201 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

wrdApp.Selection() question

30
Hi Guys,

Hopefully this is a quick one, i am currently building an application that mail merge's data to Microsoft Word, when the text is sent across it has line spacing all i want to do is set it to no spacing, i have looked at:

wrdSelection.Paragraphs.Format.space1
wrdSelection.Paragraphs.Format.space15
wrdSelection.Paragraphs.Format.space2

i cannot seem to find either a "no line space" or "space0" for instance, can any one help me out?

Regards

Jay!
Jul 30 '08 #1
3 1574
kenobewan
4,871 Expert 4TB
Please provide more info re your application. Thanks.
Jul 30 '08 #2
Asprisa
30
Hi There,

I have extracted this code as an example to show you, basically it opens a word doc, and writes text and images onto the document, but when it does it, there is automatically a line seperating two lines of text, so i wondered if there was a way of setting the paragraph to 'no spacing' .

Expand|Select|Wrap|Line Numbers
  1.  Dim wrdApp As Word.Application
  2.     Dim wrdDoc As Word._Document
  3.  
  4.  ' Create an instance of Word  and make it visible.
  5.         wrdApp = CreateObject("Word.Application")
  6.         wrdApp.Visible = True
  7.         ' Add a new document.
  8.         wrdDoc = wrdApp.Documents.Add()
  9.         wrdDoc.Select()
  10.         wrdSelection = wrdApp.Selection()
  11.  
  12.         wrdSelection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft
  13.  
  14. InsertLines(1) ' creates a space between blocks of text
  15.  
  16.         wrdSelection.Font.Name = "Arial"
  17.         wrdSelection.Font.Bold = True
  18.         wrdSelection.Font.Size = 9
  19.         wrdSelection.TypeText("Total Excl VAT @" & vatratetxt.Text)
  20.         wrdSelection.Font.Bold = False
  21.         wrdSelection.TypeText(" ")
  22.         wrdSelection.TypeText("      " & vatexcl.ToString("c") & vbCr)
  23.  
  24.         wrdSelection.Font.Name = "Arial"
  25.         wrdSelection.Font.Bold = True
  26.         wrdSelection.Font.Size = 9
  27.         wrdSelection.TypeText("Total VAT         @" & vatratetxt.Text)
  28.         wrdSelection.Font.Bold = False
  29.         wrdSelection.TypeText(" ")
  30.  
  31.         wrdSelection.TypeText("      " & vat.ToString("c") & vbCr)
  32.  
  33.         wrdSelection.Font.Name = "Arial"
  34.         wrdSelection.Font.Bold = True
  35.         wrdSelection.Font.Size = 9
  36.         wrdSelection.TypeText("Total Incl VAT  @" & vatratetxt.Text)
  37.         wrdSelection.Font.Bold = False
  38.         wrdSelection.TypeText(" ")
  39.         wrdSelection.TypeText("      " & vatincl.ToString("c") & vbCr)
Any help is much appriciated!

Jay!
Jul 31 '08 #3
kenobewan
4,871 Expert 4TB
Have you tried ParagraphFormat.LineSpacingRule and giving it a value? Never used it myself...
Jul 31 '08 #4

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

Similar topics

3
by: arun venkatesan | last post by:
Hi, We use a TListView component in C++ Builder to enable the user make some selections. When the user makes a selection, the selected rows are highlighted in 'Blue'. Now, my application is...
1
by: c.anandkumar | last post by:
Hi How do I figure out if a selection in a document is in a particular control? I have a TEXTAREA in which a user can type in some text, select some text and 'apply' tags around it clicking a...
1
by: bob | last post by:
I asked a question yesterday about how I would parse a Word document using functions in some Interop.Word COM. Some told me to run a macro in Word to see how it works. Most of the code was......
8
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and...
6
by: Fnord Nase | last post by:
Hi. We're using the dblclick event in some parts of a web app interface, which works okay, but when a user double clicks on a text element, the browser selects some text before executing the...
2
by: Angus | last post by:
I am trying to change the selection in Javascript - but this HTML element is not a standard option control. On the web page it looks like a dropdown list - and you click on the right hand down...
2
by: Bruno Barberi Gnecco | last post by:
Hi, This question has been asked a few times in this group, but I haven't been able to find an answer to any of the posts. window.getSelection() returns the selected pure text, how to get it...
5
by: Jure Bogataj | last post by:
Hi all! I have a problem (performance issue) with listview. I have implemented an ItemSelectionChange on my listview and put some code in it (I build some toolbar based on selection and update...
4
by: sialater | last post by:
Hello, I realise there are a lot of topics related to this problem but many of what I have found has run cold or unresolved. What I have is an addressbook clone where there are groups which have...
9
by: Brett_A | last post by:
I have a form where the first field is a dynamic drop-down that pulls from a db (Access). The fields associated with the query are task_id, task_name and task_rate. The field has the value of...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.