Ask Experts Questions for FREE Help!
  Advanced
Register  |  Log in  
   Ask    
 Answer  
  Help  

Ask QuestionsprogressAnswer QuestionsprogressBuild ReputationprogressBecome an Expert
 
Free Answers in 3 Easy Steps

Register Now
3 Steps

At Ask Me Help Desk you can ask questions in any topic and have them answered for free by our experts. To ask questions or participate in answering them you must register for a free account. By registering you will be able to:
  • Get free answers from experts in any of our 300+ topics.
  • Accept money for answers that you provide.
  • Communicate privately with other members (PM).
  • See fewer ads.

Home > Computers & Technology > Programming > Compiled Languages > Visual Basic   »   VB list

 
Thread Tools Display Modes
Question
 
 
#1  
Old Mar 21, 2007, 08:05 AM
lemond
New Member
lemond is offline
 
Join Date: Mar 2007
Posts: 2
lemond See this member's comment history on his/her Profile page.
VB list

I just created a macro for creating a list in Word. The problem I am having is that it will not cut the selections.

Sub EditEmailList()
Dim List As String 'variable name goes here As datatype
strSearchText = " ("
TopOfFile
SearchDown List 'variable name
While Selection.Find.Found
Selection.MoveRight 'use IntelliSense (type a dot "." after "Selection") to move the cursor to the right
Selection.TypeBackspace 'use IntelliSense to make program type a backspace
Repeat
Selection.TypeText Chr(9)
Selection.MoveLeft 'use IntelliSense to move the cursor to the left
Selection.Extend 'use IntelliSense to extend the selection
SearchUp " "
If Selection.Find.Found = True Then
Selection.MoveRight
Selection.EscapeKey 'use IntelliSense to perform the same action as the Esc key on the keyboard
Selection.Cut 'use IntelliSense to cut the selection
Selection.TypeBackspace 'use IntelliSense to type a backspace
Selection.MoveUp Unit:=wdParagraph
Selection.PasteAppendTable 'use IntelliSense to paste the clipboard content
Selection.TypeText Chr(9)
Else
End
End If
Selection.MoveDown 'use IntelliSense to move down one paragraph
SearchDown List
Wend
Selection.WholeStory
Selection.ParagraphFormat.Reset
Selection.ConvertToTable Separator:=wdSeparateByTabs, NumColumns:=3, NumRows:=6
Selection.Tables(1).AutoFitBehavior (wdAutoFitContent)
TopOfFile
Selection.InsertRowsAbove 1
Selection.Font.Bold = True
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.TypeText Text:="LastName"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="FirstName"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="Email"
TopOfFile
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ")"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
'following is message output telling user what the program did
MsgBox "[FirstName LastName (e-mail address)]" & " for " & intCnt & " different records"
End Sub
Sub TopOfFile()
Selection.HomeKey Unit:=wdStory
End Sub
Sub SearchDown(strPassedText As String)
Selection.Find.Text = strPassedText
Selection.Find.Forward = True
Selection.Find.Wrap = wdFindStop
Selection.Find.MatchCase = False
Selection.Find.MatchWholeWord = False
Selection.Find.Format = False
Selection.Find.Execute
End Sub
Sub SearchUp(strPassedText As String)
Selection.Find.Text = strPassedText
Selection.Find.Forward = False
Selection.Find.Wrap = wdFindStop
Selection.Find.MatchCase = False
Selection.Find.MatchWholeWord = False
Selection.Find.Format = False
Selection.Find.Execute
End Sub

Reply With Quote
 
     



Thread Tools
Display Modes

 
Similar Sponsors

Similar Threads
Question Asker Forum Answers Last Post
reference list moshira Research 2 Apr 28, 2007 06:10 PM
list of providers laketahoedean Other Money & Services 0 Feb 2, 2007 06:42 PM
Manufacturers List ffiint2007 Books & Literature 1 Jan 30, 2007 07:15 PM
list boxes jonmich Internet & the Web 0 Apr 4, 2005 12:17 AM
List box jonmich Internet & the Web 0 Mar 24, 2005 10:36 PM




Copyright ©2003 - 2007, Ask Me Help Desk.
All times are GMT -8. The time now is 12:35 AM.