how to check MS Word paragraph line spacing using vba script.
here is code where line spacing are change in paragraph(1).
we add paragraph(1) line space 2.
now how can we get it if we give same paragraph(1) and its gives us 2.
To check line spacing: Selection.ParagraphFormat.LineSpacing
Te increase line spacing Selection.ParagraphFormat.LineSpacing = .LineSpacing + 1
Te decrease line spacing Selection.ParagraphFormat.LineSpacing = .LineSpacing - 1
thanks.
Record a macro where you change the line setting and then look at the result you get.
If there is any keyword you don't understand put the cursor on it and press F1, this will bring up the MS Help page for that keyword.
To record a macro you need to have the Developer Tab enabled.
Related
I am trying to make the hanging lines on a presentation slide consistent so that both the hanging lines and first line have the same left indentation.
For example, in the screenshot attached below, I want the words "Thousands", "surface", and "activities" to start at the same left margin (as shown in the blue highlighted part in the slide). Any information on thus is so helpful.
From your screen shot, I doubt that paragraph indentation/first line indentation is the cause. However, if it is, this is the VBA that should fix it. The TextFrame2 object is the one with updated paragraph spacing for current versions of PowerPoint:
With ActiveWindow.Selection.ShapeRange.TextFrame2.TextRange.Paragraphs(Start:=1, Length:=1).ParagraphFormat
.FirstLineIndent = -18
.LeftIndent = 18
End With
I have assigned string having carriage return to PowerPoint shape's texframe text but when I get from it. the carriage return is now Ascii 11 VT. I have searched google but I didn't find any solution exception to use linefeed but that does not work in other scenario.
Here is Code
_answerText = "Yes" + Chr(CharCode:=13) + "No"
powerPointShapeObject.TextFrame.TextRange.Text = _answerText
Could some one please help me to understand why it happen. Thanks in Advance
PowerPoint uses different characters for line endings depending on PPT version and on whether the text is part of a slide title or any other text on a slide.
This page on my PPTFAQ site explains in more detail:
Paragraph endings and line breaks
http://www.pptfaq.com/FAQ00992_Paragraph_endings_and_line_breaks.htm
Try this instead:
_answerText = "Yes" & "\r" & "No"
powerPointShapeObject.TextFrame.TextRange.Text = _answerText
I'm curious if there is a way to paste text to the end of every line in Sublime 2? And conversely, to the beginning of every line.
test line one
test line two
test line three
test line four
...
Say you have 100 lines of text in the editor, and you want to paste quotation marks to the beginning and end of each line.
Is there an easy way to do this or a plugin that anyone would know of? This would often save me a lot of time on various projects.
Thanks.
Yeah Regex is cool, but there are other alternative.
Select all the lines you want to prefix or suffix
Goto menu Selection -> Split into Lines (Cmd/Ctrl + Shift + L)
This allows you to edit multiple lines at once. Now you can add *Quotes (") or anything * at start and end of each lines.
Here's the workflow I use all the time, using the keyboard only
Ctrl/Cmd + A Select All
Ctrl/Cmd + Shift + L Split into Lines
' Surround every line with quotes
Note that this doesn't work if there are blank lines in the selection.
Select all the lines on which you want to add prefix or suffix. (But if you want to add prefix or suffix to only specific lines, you can use ctrl+Left mouse button to create multiple cursors.)
Push Ctrl+Shift+L.
Push Home key and add prefix.
Push End key and add suffix.
Note, disable wordwrap, otherwise it will not work properly if your lines are longer than sublime's width.
Let's say you have these lines of code:
test line one
test line two
test line three
test line four
Using Search and Replace Ctrl+H with Regex let's find this: ^ and replace it with ", we'll have this:
"test line one
"test line two
"test line three
"test line four
Now let's search this: $ and replace it with ", now we'll have this:
"test line one"
"test line two"
"test line three"
"test line four"
You can use the Search & Replace feature with this regex ^([\w\d\_\.\s\-]*)$ to find text and the replaced text is "$1".
Use column selection. Column selection is one of the unique features of Sublime2; it is used to give you multiple matched cursors (tutorial here). To get multiple cursors, do one of the following:
Mouse:
Hold down the shift (Windows/Linux) or option key (Mac) while selecting a region with the mouse.
Clicking middle mouse button (or scroll) will select as a column also.
Keyboard:
Select the desired region.
Type control+shift+L (Windows/Linux) or command+shift+L (Mac)
You now have multiple lines selected, so you could type a quotation mark at the beginning and end of each line. It would be better to take advantage of Sublime's capabilities, and just type ". When you do this, Sublime automatically quotes the selected text.
Type esc to exit multiple cursor mode.
Select all lines you want to add a suffix or prefix.(command+ A to select all the lines)
Press command+shift+L. This will put one cursor at the end of every line and all the selected lines would still be selected.
For adding suffix press command+right and for adding prefix command+left. This will deselect all the earlier selected text and there will only be cursors at the end or start of every line.
Add required text
I have a paragraph and after executing :
paragraph.ParagraphFormat.FirstLineIndent = 18;
paragraph.ParagraphFormat.LeftIndent = 18;
when I check Paragraph dialog box, I get:
Indentation Before Text 0.25" - OK, this is what I wanted
Special First line 0.25" - it's not what I want.
Instead of First line I want to have Special set to Hanging. Is it possible to control it with code?
Instead of First line I want to have Special set to Hanging. Is it possible to control it with code?
Yes it is possible :)
Just remember the thumb rule
For FirstLine use a positive value and
For Hanging use a negative value
Change your code to
paragraph.ParagraphFormat.FirstLineIndent = -18;
I am writting to an excel file from my vb code. The code goes as below
xlsheet3 = xlBook.Sheets.Add(After:=xlSheet)
With xlsheet3
.Columns(5).NumberFormat = "#"
.Cells(j + 1, 5) = someStringValue 'Here "j" is a row counter and this line is in a "for loop"
end with
After writing to excel, most of the cells in excel are correct. But some of the cell's text comes as ####### however if I click on the cell, formula bar shows the correct result. I have tried giving single code before adding the text still that did not help.
Please help me in resolving this.
Thank you
There is not any issue with your code. You need to increase the width of the column or have to use word wrap. In excel if your value is not fully visible it shows it is "######".
If widening and wrapping text doesn't work and the format is set to text which allows display of only 255 characters, try changing the format to general.
This just indicates that the cell is too small for showing the result: make it wider.
See https://superuser.com/questions/65556/excel-displays-for-long-text-whats-wrong for some common reasons why Excel displays "######" in cells.
Either the cell is too narrow to display the contents or the contents are over 256 characters.
Check what you're writing to the cell. If it's not too long then all you need to do is resize the column to fit the new contents.
This is simply what Excel does when the data in a column is too wide to be displayed in the current column width. Make the column slightly wider and you will see all your data.
To autosize the column so it is wide enough to display all its data, double click the column divider at the right edge of the column, in the header bar.