close

I'm kinda new to vba. This took me lots of hours to make/I'm confused. I
need clarification help.

Goal:
Find paragraph with specific level format (1/2 for example) and add
space to beginning of each selection

The functions I need are already created, except I have some problems:
For my function to work throughout, I have to type something in a
msgbox for my script to go forward for each manipulation.

Is there anyway to make it run smoothly, and then to have a msgbox to
tell me that my script was done working its function?
Sub macccta()
Dim sResponse As String

Do

sResponse = InputBox(Prompt:=quot;Type no to exit,Babyquot;, _
Title:=quot;quot;, Default:=quot;quot;)
If sResponse = quot;noquot; Then Exit Sub Else 'this is
convenient because I can just type quot;noquot; to exit a nasty loop; this
keeps on looping... where should it place?If sResponse gt; quot;quot; Then 'lt;--what does this single
statement means, especially the gt;? I think its always making me need
to input anything to make the rest of the script work

Selection.HomeKey Unit:=wdStory 'start in the beginning of doc

Selection.Find.ClearFormatting
With Selection.Find
'we are finding heading 2
.ParagraphFormat.OutlineLevel = wdOutlineLevel2
Do While .Execute

Selection.InsertBefore quot; quot;'election is converted as body text, because if not, the script keeps
on looping because I dont know what I'm missing to make it stop
Selection.ParagraphFormat.OutlineLevel = wdOutlineLevelBodyText

Loop
End With

End If
Loop While sResponse lt;gt; quot;quot;
MsgBox quot;donequot;End Sub

This script would be very useful for people who wants to copy all the
selection after and paste it into Freemind (a great mindmapping free
software!), which recognizes 'spaces' as heading levels.

Thx you!!!! Plz help!--
Ambrosia
------------------------------------------------------------------------
Ambrosia's Profile: www.excelforum.com/member.php...oamp;userid=28146
View this thread: www.excelforum.com/showthread...hreadid=524664You may get much better answers in one of the newsgroups dedicated to
MSWord--not Excel.

Ambrosia wrote:
gt;
gt; I'm kinda new to vba. This took me lots of hours to make/I'm confused. I
gt; need clarification help.
gt;
gt; Goal:
gt; Find paragraph with specific level format (1/2 for example) and add
gt; space to beginning of each selection
gt;
gt; The functions I need are already created, except I have some problems:
gt; For my function to work throughout, I have to type something in a
gt; msgbox for my script to go forward for each manipulation.
gt;
gt; Is there anyway to make it run smoothly, and then to have a msgbox to
gt; tell me that my script was done working its function?
gt;
gt; Sub macccta()
gt; Dim sResponse As String
gt;
gt; Do
gt;
gt; sResponse = InputBox(Prompt:=quot;Type no to exit,Babyquot;, _
gt; Title:=quot;quot;, Default:=quot;quot;)
gt; If sResponse = quot;noquot; Then Exit Sub Else 'this is
gt; convenient because I can just type quot;noquot; to exit a nasty loop; this
gt; keeps on looping... where should it place?
gt;
gt; If sResponse gt; quot;quot; Then 'lt;--what does this single
gt; statement means, especially the gt;? I think its always making me need
gt; to input anything to make the rest of the script work
gt;
gt; Selection.HomeKey Unit:=wdStory 'start in the beginning of doc
gt;
gt; Selection.Find.ClearFormatting
gt; With Selection.Find
gt; 'we are finding heading 2
gt; ParagraphFormat.OutlineLevel = wdOutlineLevel2
gt;
gt; Do While .Execute
gt;
gt; Selection.InsertBefore quot; quot;
gt;
gt; 'election is converted as body text, because if not, the script keeps
gt; on looping because I dont know what I'm missing to make it stop
gt; Selection.ParagraphFormat.OutlineLevel = wdOutlineLevelBodyText
gt;
gt; Loop
gt; End With
gt;
gt; End If
gt; Loop While sResponse lt;gt; quot;quot;
gt; MsgBox quot;donequot;
gt;
gt; End Sub
gt;
gt; This script would be very useful for people who wants to copy all the
gt; selection after and paste it into Freemind (a great mindmapping free
gt; software!), which recognizes 'spaces' as heading levels.
gt;
gt; Thx you!!!! Plz help!
gt;
gt; --
gt; Ambrosia
gt; ------------------------------------------------------------------------
gt; Ambrosia's Profile: www.excelforum.com/member.php...oamp;userid=28146
gt; View this thread: www.excelforum.com/showthread...hreadid=524664

--

Dave Peterson


Lol, I'll answer me own question! Sorry I asked in excel a Word
question...
Sub sodsaS()
With ActiveDocument.Content.Find
.ClearFormatting
.ParagraphFormat.OutlineLevel = wdOutlineLevel2 '---change numbers
according to outline level
Do While .Execute(FindText:=quot;quot;, Forward:=True, _
Format:=True) = True
With .Parent
.StartOf Unit:=wdParagraph, Extend:=wdMove
.InsertAfter quot;#quot; '-----is what gets inserted in the
beginning!
.Move Unit:=wdParagraph, Count:=1
End With
Loop
End With
End SubGood luck people! lol--
Ambrosia
------------------------------------------------------------------------
Ambrosia's Profile: www.excelforum.com/member.php...oamp;userid=28146
View this thread: www.excelforum.com/showthread...hreadid=524664

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()