Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default formattig word paragraphs from excel

I would like to apply two different word styles to the text inserted from cells(rowno, 3) and cells(rowno, 1). The names of the styles in the template used to populate the information are ProjectStyle, DetailsStyle.

How can I apply word style after inserting new information. I cannot find the syntax which will work.

For rowno = i - 1 To 2 Step -1
With ActiveDocument
.Bookmarks("OperationsStart").Range.InsertAfter Chr(13)
.Bookmarks("OperationsStart").Range.InsertAfter Chr(13)
.Bookmarks("OperationsStart").Range.InsertAfter Cells(rowno, 3)
.Bookmarks("OperationsStart").Range.InsertAfter Chr(13)
.Bookmarks("OperationsStart").Range.InsertAfter Cells(rowno, 1)
End With
Next rowno

Thanks for help.

Regards,

Tony
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default formattig word paragraphs from excel

I would like to apply two different word styles to the text inserted
from cells(rowno, 3) and cells(rowno, 1). The names of the styles in
the template used to populate the information are ProjectStyle,
DetailsStyle.

How can I apply word style after inserting new information. I cannot
find the syntax which will work.

For rowno = i - 1 To 2 Step -1
With ActiveDocument
.Bookmarks("OperationsStart").Range.InsertAfter
Chr(13)
.Bookmarks("OperationsStart").Range.InsertAfter Chr(13)
.Bookmarks("OperationsStart").Range.InsertAfter Cells(rowno, 3)
.Bookmarks("OperationsStart").Range.InsertAfter Chr(13)
.Bookmarks("OperationsStart").Range.InsertAfter
Cells(rowno, 1) End With Next rowno

Thanks for help.

Regards,

Tony


Have you tried doing it manually in Word with the macro recorder
running?

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default formattig word paragraphs from excel

Syntax from Word is not accepted in Excel vba, I am getting errors. I am not sure how it should br changed to work. I have seen code which works well for last paragraph in document. I need to find out how to modify style for current oaragraph after inserting text after bookmark. So far I cannot do it. Any suggestions ?
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default formattig word paragraphs from excel

Hi,

Am Wed, 14 Jan 2015 01:32:12 -0800 (PST) schrieb Zbyszek Pluta:

Syntax from Word is not accepted in Excel vba, I am getting errors. I am not sure how it should br changed to work. I have seen code which works well for last paragraph in document. I need to find out how to modify style for current oaragraph after inserting text after bookmark. So far I cannot do it. Any suggestions ?


Excel = VBA editor = Extras = References and activate
Microsoft Word xx.0 Object Library

Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default formattig word paragraphs from excel

On Wednesday, 14 January 2015 20:40:31 UTC+11, Claus Busch wrote:
Hi,

Am Wed, 14 Jan 2015 01:32:12 -0800 (PST) schrieb Zbyszek Pluta:

Syntax from Word is not accepted in Excel vba, I am getting errors. I am not sure how it should br changed to work. I have seen code which works well for last paragraph in document. I need to find out how to modify style for current oaragraph after inserting text after bookmark. So far I cannot do it. Any suggestions ?


Excel = VBA editor = Extras = References and activate
Microsoft Word xx.0 Object Library

Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional


Hi Claus,

I have already activated this library. I have managed to do nearly all I wanted to do. The last thing I am trying to achieve is to apply word styles from the template to give it better look. And this is where I am experiencing the problems. I cannot find the syntax for applying the style to the paragraph created by using insertafter. Can you help me with this one ???

Regards,

Tony


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default formattig word paragraphs from excel

I have solved this problem. The code which does what I wanted is:

With wordDoc
.Bookmarks("SafetyStart").Range.InsertAfter Chr(13)
.Bookmarks("SafetyStart").Range.InsertAfter Chr(13)
.Bookmarks("SafetyStart").Range.Style = .Styles("DetailsReported")
.Bookmarks("SafetyStart").Range.InsertAfter DetailsEntry
.Bookmarks("SafetyStart").Range.InsertAfter Chr(13)
.Bookmarks("SafetyStart").Range.Style = .Styles("ProjectReported")
.Bookmarks("SafetyStart").Range.InsertAfter ProjectEntry
End With
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Manage Word paragraphs inside Excel Alex St-Pierre Excel Programming 6 November 22nd 06 08:02 PM
Moving paragraphs from MS Word to Excel [email protected] Excel Discussion (Misc queries) 3 March 2nd 05 02:36 AM
How to select the first 5 paragraphs in a Word Document from Excel quartz[_2_] Excel Programming 1 January 12th 05 03:52 PM
Display Word Paragraphs in Excel??? quartz[_2_] Excel Programming 2 January 10th 05 07:39 PM
Find paragraphs in word and export to Excel Matt Shaw Excel Programming 1 July 19th 03 09:22 AM


All times are GMT +1. The time now is 04:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"