OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Converting MS Word Macrop to OO Writer

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
knichel
General User
General User


Joined: 23 Oct 2006
Posts: 16

PostPosted: Wed Jul 01, 2009 11:10 am    Post subject: Converting MS Word Macrop to OO Writer Reply with quote

My wife has a document that has macros in it and I am wondering if the macro can be converted (manually) to work under OO Writer.

Code:
Rem Attribute VBA_ModuleType=VBAModule
Sub AutoNew
Rem Sub AutoNew()
Rem
Rem     strHeader = InputBox("Enter the Short Header. This is the first two or three KEYWORDS words of the title. Use upper and lowercase letters.", "Short Header", "Short Title Goes Here")
Rem     strTitle = InputBox("Enter the full Title of the Paper. Use upper and lowercase letters.", "Title of Paper", "Title of Paper Goes Here")
Rem     strAuthor = InputBox("Enter your full name. Do not include your titles or degrees.", "Author's Name", "Your Name Goes Here")
Rem     strSchool = InputBox("Enter the name of your college or university. If your university is the University of Phoenix Online, simple click OK.", "School", "University of Phoenix Online")
Rem     Selection.Font.Size = 12
Rem     With ActiveDocument.PageSetup
Rem         .LineNumbering.Active = False
Rem         .Orientation = wdOrientPortrait
Rem         .TopMargin = InchesToPoints(1)
Rem         .BottomMargin = InchesToPoints(1)
Rem         .LeftMargin = InchesToPoints(1)
Rem         .RightMargin = InchesToPoints(1)
Rem         .Gutter = InchesToPoints(0)
Rem         .HeaderDistance = InchesToPoints(0.5)
Rem         .FooterDistance = InchesToPoints(0.5)
Rem         .PageWidth = InchesToPoints(8.5)
Rem         .PageHeight = InchesToPoints(11)
Rem         .FirstPageTray = wdPrinterDefaultBin
Rem         .OtherPagesTray = wdPrinterDefaultBin
Rem         .SectionStart = wdSectionNewPage
Rem         .OddAndEvenPagesHeaderFooter = False
Rem         .DifferentFirstPageHeaderFooter = False
Rem         .VerticalAlignment = wdAlignVerticalTop
Rem         .SuppressEndnotes = False
Rem         .MirrorMargins = False
Rem         .TwoPagesOnOne = False
Rem         .GutterPos = wdGutterPosLeft
Rem     End With
Rem     With Selection.ParagraphFormat
Rem         .LeftIndent = InchesToPoints(0)
Rem         .RightIndent = InchesToPoints(0)
Rem         .SpaceBefore = 0
Rem         .SpaceBeforeAuto = False
Rem         .SpaceAfter = 0
Rem         .SpaceAfterAuto = False
Rem         .LineSpacingRule = wdLineSpaceDouble
Rem         .Alignment = wdAlignParagraphLeft
Rem         .WidowControl = True
Rem         .KeepWithNext = False
Rem         .KeepTogether = False
Rem         .PageBreakBefore = False
Rem         .NoLineNumber = False
Rem         .Hyphenation = True
Rem         .FirstLineIndent = InchesToPoints(0.5)
Rem         .OutlineLevel = wdOutlineLevelBodyText
Rem         .CharacterUnitLeftIndent = 0
Rem         .CharacterUnitRightIndent = 0
Rem         .CharacterUnitFirstLineIndent = 0
Rem         .LineUnitBefore = 0
Rem         .LineUnitAfter = 0
Rem     End With
Rem     If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
Rem         ActiveWindow.Panes(2).Close
Rem     End If
Rem     If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
Rem         ActivePane.View.Type = wdOutlineView Then
Rem         ActiveWindow.ActivePane.View.Type = wdPrintView
Rem     End If
Rem     ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Rem     Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
Rem     Selection.TypeText Text:=strHeader + "     "
Rem     Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldPage
Rem     ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Rem     If ActiveWindow.View.SplitSpecial = wdPaneNone Then
Rem         ActiveWindow.ActivePane.View.Type = wdPrintView
Rem     Else
Rem         ActiveWindow.View.Type = wdPrintView
Rem     End If
Rem     Selection.TypeParagraph
Rem     Selection.TypeParagraph
Rem     Selection.TypeParagraph
Rem     Selection.TypeParagraph
Rem     Selection.TypeParagraph
Rem     Selection.TypeParagraph
Rem     Selection.TypeParagraph
Rem     Selection.TypeParagraph
Rem     Selection.TypeParagraph
Rem     Selection.TypeParagraph
Rem     Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Rem     Selection.TypeText Text:=strTitle
Rem     Selection.TypeParagraph
Rem     Selection.TypeText Text:=strAuthor
Rem     Selection.TypeParagraph
Rem     Selection.TypeText Text:=strSchool
Rem     Selection.InsertBreak Type:=wdPageBreak
Rem     Selection.TypeText Text:=strTitle
Rem     Selection.TypeParagraph
Rem     Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
Rem     Selection.TypeText Text:= _
Rem         "[The introduction goes here. It should be one or two paragra"
Rem     Selection.TypeText Text:= _
Rem         "phs explaining the methods and findings of your paper. The i"
Rem     Selection.TypeText Text:= _
Rem         "ntroduction should prepare the reader for the contents of th"
Rem     Selection.TypeText Text:= _
Rem         "e paper by previewing the three main topics in your paper. B"
Rem     Selection.TypeText Text:= _
Rem         "e sure to end with a transition word or sentence to lead int"
Rem     Selection.TypeText Text:= _
Rem         "o Section 1 of your paper. Triple click anywhere in this par"
Rem     Selection.TypeText Text:= _
Rem         "agraph to begin typing your own introduction.]"
Rem         
Rem     Selection.TypeParagraph
Rem     Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Rem     Selection.TypeText Text:= _
Rem         "Heading for Section 1 of Your Paper (Edit this heading!)"
Rem         
Rem     Selection.TypeParagraph
Rem     Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
Rem     Selection.TypeText Text:= _
Rem         "[This is the first main topic of your pape"
Rem     Selection.TypeText Text:= _
Rem         "r. It should be one to four paragraphs explaining the first ma"
Rem     Selection.TypeText Text:= _
Rem         "in topic in your paper. Be sure to end with a transition word "
Rem     Selection.TypeText Text:= _
Rem         "or sentence to lead into Section 2 of your paper. Triple click"
Rem     Selection.TypeText Text:= _
Rem         " anywhere in this paragraph to begin typing.]"
Rem         
Rem     Selection.TypeParagraph
Rem     Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Rem     Selection.TypeText Text:= _
Rem         "Heading for Section 2 of Your Paper (Edit this heading!)"
Rem     
Rem     Selection.TypeParagraph
Rem     Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
Rem     Selection.TypeText Text:= _
Rem         "[This is the second main topic of your paper. It should be o"
Rem     Selection.TypeText Text:= _
Rem         "ne to four paragraphs explaining the second main topic in yo"
Rem     Selection.TypeText Text:= _
Rem         "ur paper. Be sure to end with a transition word or sentence "
Rem     Selection.TypeText Text:= _
Rem         "to lead into Section 3 of your paper. Triple click anywhere "
Rem     Selection.TypeText Text:= _
Rem         "in this paragraph to begin typing.]"
Rem         
Rem     Selection.TypeParagraph
Rem     Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Rem     Selection.TypeText Text:= _
Rem         "Heading for Section 3 of Your Paper (Edit this heading!)"
Rem         
Rem     Selection.TypeParagraph
Rem     Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
Rem     Selection.TypeText Text:= _
Rem         "[This is the third and final main topic of your paper. It sh"
Rem     Selection.TypeText Text:= _
Rem         "ould be one to four paragraphs explaining the third main top"
Rem     Selection.TypeText Text:= _
Rem         "ic in your paper. Be sure to end with a transition word or s"
Rem     Selection.TypeText Text:= _
Rem         "entence to lead into the Conclusion of your paper. Triple cl"
Rem     Selection.TypeText Text:= _
Rem         "ick anywhere in this paragraph to begin typing.]"
Rem     
Rem     Selection.TypeParagraph
Rem     Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Rem     Selection.TypeText Text:="Conclusion"
Rem     
Rem     Selection.TypeParagraph
Rem     Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
Rem     Selection.TypeText Text:= _
Rem         "[This is the conclusion of your paper. It should be one or t"
Rem     Selection.TypeText Text:= _
Rem         "wo paragraphs summarizing the three topics in your paper. It"
Rem     Selection.TypeText Text:= _
Rem         " should also contain your conclusions or findings. Triple cl"
Rem     Selection.TypeText Text:= _
Rem         "ick anywhere in this paragraph to begin typing.]"
Rem     
Rem     
Rem     
Rem     
Rem     Selection.InsertBreak Type:=wdPageBreak
Rem     Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Rem     Selection.TypeText Text:="References"
Rem     Selection.TypeParagraph
Rem     Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
Rem     With Selection.ParagraphFormat
Rem         .LeftIndent = InchesToPoints(0.5)
Rem         .RightIndent = InchesToPoints(0)
Rem         .SpaceBefore = 0
Rem         .SpaceBeforeAuto = False
Rem         .SpaceAfter = 0
Rem         .SpaceAfterAuto = False
Rem         .LineSpacingRule = wdLineSpaceDouble
Rem         .Alignment = wdAlignParagraphLeft
Rem         .WidowControl = True
Rem         .KeepWithNext = False
Rem         .KeepTogether = False
Rem         .PageBreakBefore = False
Rem         .NoLineNumber = False
Rem         .Hyphenation = True
Rem         .FirstLineIndent = InchesToPoints(-0.5)
Rem         .OutlineLevel = wdOutlineLevelBodyText
Rem         .CharacterUnitLeftIndent = 0
Rem         .CharacterUnitRightIndent = 0
Rem         .CharacterUnitFirstLineIndent = 0
Rem         .LineUnitBefore = 0
Rem         .LineUnitAfter = 0
Rem     End With
Rem     Selection.TypeText Text:= _
Rem         "[Your references go here in alphabetical order (by author). "
Rem     Selection.TypeText Text:= _
Rem         "This page is already set up with hanging indents."
Rem     Selection.TypeText Text:= _
Rem         " Triple click anywhere in this paragraph to enter your first"
Rem     Selection.TypeText Text:= _
Rem         " reference. Include "
Rem     Selection.Font.Bold = wdToggle
Rem     Selection.TypeText Text:="only"
Rem     Selection.Font.Bold = wdToggle
Rem     Selection.TypeText Text:= _
Rem         " references cited in your paper, and be sure to include "
Rem     Selection.Font.Bold = wdToggle
Rem     Selection.TypeText Text:="every"
Rem     Selection.Font.Bold = wdToggle
Rem     Selection.TypeText Text:=" reference cited in your paper.]"
Rem     Selection.TypeParagraph
Rem     Selection.MoveUp Unit:=wdScreen, Count:=140
Rem     
Rem     
Rem End Sub
Rem
End Sub


I have never written a macro, but it seems like it should be possible.

--
Mike
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group