|
-
Jul 26th, 2007, 06:24 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] [2005] MS Word and .NET formatting
I can't find the option to align my text. Could someone (probably Rob ) put me out of my misery (here's a little bit of the code that I have). So taking the text "Collaboration Report", how can I centre it?
vb Code:
oWord = CType(CreateObject("Word.Application"), Word.Application)
oWord.Visible = False
oDoc = oWord.Documents.Add
'Insert a paragraph at the beginning of the Word Doc
oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.Text = "Collaboration Report"
'Want to specify centre alignment here if I can ???
oPara1.Range.Font.Bold = 1
oPara1.Format.SpaceAfter = 6
oPara1.Range.InsertParagraphAfter()
-
Jul 26th, 2007, 06:31 PM
#2
Re: [2005] MS Word and .NET formatting
Something like this is what you need?
Code:
Dim oPara1 As Microsoft.Office.Interop.Word.Paragraph = oWord.Documents(1).Content.Paragraphs.Add
oPara1.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 26th, 2007, 06:38 PM
#3
Thread Starter
Frenzied Member
Re: [2005] MS Word and .NET formatting
Sigh. yes, that's it. I don't know what I was thinking.
I tried every option from oParar1.Range. onwards. Still getting used to using vb and word. Thanks again.
-
Jul 26th, 2007, 06:47 PM
#4
Re: [RESOLVED] [2005] MS Word and .NET formatting
No prob. Glad to help.
Ps, sorry for the 7 minute delay in my reply. 
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 26th, 2007, 06:53 PM
#5
Thread Starter
Frenzied Member
Re: [RESOLVED] [2005] MS Word and .NET formatting
a whole 7 mins! A terrible wait. Time to up your game Rob. You are starting to slip.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|