Thanks for your reply and help I have went this far novice as I am. For some
reason It does not do the merge as befor. I will enclose complete procedure
as I have it with comments part of it I've got some not. Also it takes to
long and I get error message taking to long. This is not a time senstive
project have until Nov to get done. Vet's Parade day need friday before. Here
is procedure see what you think any changes I can compare to my copy to see
what I did wrong
Thanks
Option Explicit
Dim jCtr As Integer
Dim HowMany As Variable
Private Sub OptionButton1_Click()
' blanks Macro This with takes care of space symbols in cell not seen.
Dim jCtr As Integer
Dim HowMany As Integer
OptionButton1.Value = False
Worksheets("Data").Activate
With ActiveSheet
For jCtr = 100 To HowMany
Columns("D:I").Replace _
What:=Space(jCtr), _
Replacement:="", _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
MatchCase:=False
Next jCtr
End With
'This locates missing entries
Range("d5:m100").Select
Selection.specialcells(xlCellTypeBlanks).Select
Selection.ClearContents
Dim Blanks As Long
Blanks = msgbox(prompt:="Do you have blanks to complete?",
Buttons:=vbYesNo)
If Blanks = vbYes Then
UserForm4.Hide
Userform1.Hide
Exit Sub
If Blanks = vbNo Then
'Creates worksheet for mail merge deleted at end
Sheets("MailE").Select
Sheets("MailE").Copy
ActiveWorkbook.SaveAs Filename:= _
"C:\Parade\MailEcopy.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End If
End If
'Above works OK
'I have a macro in Excel that calls a macro in a Word document with this code:
'Dim wordapp As Application (This was copied from net)
' wordapp.Visible = True
' wordapp.Activate
' wordapp.Run '("My Macro")(Have not used this)
'You use Word's activewindow, kind of like this. Use the macro recorder in
Word to get the syntax
'correct, then just copy it over to Excel and use the With structure:
Dim oWord As Word.Application
Dim myDoc As Word.Document
Set oWord = CreateObject("word.application")
oWord.Application.Visible = True
' slower than 7 year itch doesnot complete action error taking to long
' MailE_2 Macro
' Macro recorded 7/23/2007 by Curtiss A. Greer
With Selection
ChangeFileOpenDirectory "C:\Parade\"
Documents.Open Filename:="LetterHead.doc", ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
ActiveDocument.MailMerge.OpenDataSource Name:="C:\Parade\mailEcopy.xls", _
ConfirmConversions:=False, ReadOnly:=True, LinkToSource:=False, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, _
Connection:="Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User
ID=" & _
"Admin;Data Source=""C:\mailEcopy.xls"";Mode=Read;Extended " & _
"Properties=""" & _
"HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet OLEDB:Registry " & _
"Path="""";Jet OLEDB
atabase Password="""";Jet OL", _
SQLStatement:="SELECT * FROM `Sheet1$`"
', SQLStatement1:="", _
'SubType:=wdMergeSubTypeAccess
'Connection:="", SQLStatement:="", SQLStatement1:=""
ActiveDocument.MailMerge.DataSource.QueryString = _
"SELECT * FROM C:\Parade\mailEcopy.xls WHERE ((Contact_Person IS NOT
NULL ))" _
& ""
With ActiveDocument.MailMerge
.Destination = wdSendToPrinter
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = False
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
ActiveDocument.SaveAs Filename:="mailE2.doc",
FileFormat:=wdFormatDocument _
, LockComments:=False, Password:="", AddToRecentFiles:=True, _
WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False,
SaveAsAOCELetter:= _
False
CommandBars("Stop Recording").Visible = False
End With
' oWord.Application.Quit
' Set oWord = Nothing
Sheets("Parade\mailEcopy").Select
Sheets("Parade\mailEcopy").Delete
UserForm4.Hide
Userform1.Hide
Sheets("Data").Select
Range("A3").Select
Userform1.Show
End Sub