Error 4198 Word 2010
Contents |
soon) Ruby (coming soon) Getting Started Code Samples Resources Patterns and Practices App Registration Tool Events Podcasts Training API Sandbox Videos Documentation Office Add-ins Office Add-in Availability Office Add-ins runtime error 4198 command failed Changelog Microsoft Graph API Office 365 Connectors Office 365 REST APIs SharePoint Add-ins error 4198 command failed word 2007 Office UI Fabric Submit to the Office Store All Documentation https://www.yammer.com/ http://feeds.feedburner.com/office/fmNx Ask a question Quick access Forums home
Microsoft Visual Basic Runtime Error 4198
Browse forums users FAQ Search related threads Remove From My Forums Answered by: Word 2010 VBA: Run-time error '4198' Command Failed - MailMerge Microsoft Office for Developers > Word for Developers Question
Runtime 4198
0 Sign in to vote I have written a function in Excel 2010 using VBA that performs a mail merge in Word 2010 using a CSV file that I generatedwith data from the Excel workbook. Function EmailVerstuurd() As Boolean Dim appWord As Word.Application Dim blnRunning As Boolean Dim doc As Document Dim strEmailInloggen As String Dim strRegje As String Dim i As Integer, excel vba runtime error 4198 rMail As Range Dim secAutomation As MsoAutomationSecurity 1 On Error GoTo Err_handler 'Capture the name of the procedure for debugging purposes 2 strProcedure = "EmailVerstuurd" 'Full path of mail merge main document 3 strEmailInloggen = "V:\Opleiding\Bedrijfsopleidingen\Typecursus\Procedures\Email inloggegevens nieuwe gebruiker.doc" 'Check if an instance of Word is already running 4 If modCode.IsAppRunning("Word.Application") Then 5 Set appWord = GetObject(, "Word.Application") 6 blnRunning = True 7 Else 8 Set appWord = CreateObject("Word.Application") 9 End If 'If necessary set registry key kb825765 / http://vba-corner.livejournal.com/3054.html 10 strRegje = "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Word\Options\SQLSecurityCheck" 11 If Not modFunctions.RegKeyExists(strRegje) Then 12 modFunctions.RegKeySave strRegje, "00000000", "REG_DWORD" 13 End If 'Put security to low kb886633 14 secAutomation = appWord.AutomationSecurity 15 appWord.AutomationSecurity = msoAutomationSecurityLow 'Open mail merge main document 16 Set doc = appWord.Documents.Open(FileName:=strEmailInloggen) 'Perform the mail merge - send email to selected recipients 17 With doc.MailMerge 18 .OpenDataSource Name:=ActiveWorkbook.Path & "\" & "Import_TypingMaster.csv" 19 .Destination = wdSendToEmail 20 .MailAsAttachment = False 21 .MailSubject = "Inloggevens online typecursus" 22 .MailAddressFieldName = "student_email" 23 .Execute 24 EmailVerstuurd = True 25 For i = 2 To UBound(varDln, 1) 'Put the date of the sent message in the table with participants 26 Set rMail = ActiveWorkbook.Names("Gegevens").RefersToRange.Columns(1
Word Macro when ActiveDocument.SaveAs rated by 0 users This post has 4 Replies | 1 Follower leena cardiff, Wales Since 9/25/2002 Posts 2 Reputation 40 Reply leena beeharry (leena) Posted: 9/25/2002 9:54 AM rated by 0 users Help,I keep getting the 4198 runtime error when attempting to run the following code. I've no idea why. :(I would be grateful for any help;thanks https://social.msdn.microsoft.com/Forums/office/en-US/99af2bc9-d2ee-4036-9901-afbc4c1b1174/word-2010-vba-runtime-error-4198-command-failed-mailmerge?forum=worddev in advanceLeena/*********** CODE ***********************/Private Sub Document_Open()Dim prop As StringOpen "C:\Speed2001Installation.Properties" For Input As #1While Not EOF(1)Line Input #1, propIf Left(prop, 24) = "INSTALLATION_LOC_REPORTS" Thenlocation = Mid(prop, 28)End IfWendClose #1'select the entire document so that bookmarks can be found and table of contents generated laterSelection.WholeStorySelection.Fields.UpdateSelection.HomeKey Unit:=wdStory'InsertSpreadsheets'Move to the top of the http://vbcity.com/forums/t/11162.aspx doc before saving..Selection.HomeKey Unit:=wdStorysaveAsLocation = location + "\data\rapid\reports" & "\mnds"'Save the document to the users default word folder..ActiveDocument.SaveAs fileName:=saveAsLocation, _FileFormat:=wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, _WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=FalseEnd Sub/************** END OF CODE *******************/ | Post Points: 35 rjhare England Since 6/13/2001 Posts 2,436 Reputation 35,017 Reply rjhare (rjhare) replied on 10/3/2002 12:25 AM rated by 0 users leenaError 4198 is usually associated with the VBa hyperlinks object - do you have any in your document? Also what line does it stop at when you step through on the debugger?For more help, follow this link:Error 4198 Sorry it took so long to get a reply from us - I have only just seen the post :oAny more help or advice, come back and I will answer as quick as I can :thumb: Criticism comes easier than CraftmanshipWhilst I try and answer every thread there is, I find most of m
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About http://stackoverflow.com/questions/8022533/excel-mail-merge-run-time-error-4198 Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Excel Mail Merge run time error error 4198 4198 up vote 4 down vote favorite 1 There was a previous question on stackoverflow: "Is it possible to start MAIL MERGE from excel macro (by clicking a button on sheet) I have excel sheet with data and want to export it to new word doc." This was answered Sep 29 '09 at 12:39 by dendarii 772. We had this need too because we wanted to simplify runtime error 4198 life for volunteers with limited computer skills. Unfortunately dendarii's code, modified with a suitable path, exits with run time error 4198 at the .OpenDataSource statement. Cindy Meister writing on Microsoft Office for Developer's Form> ..>Word 2010 VBA suggested 4198 errors could be due to synchronicity problems. I gave it go with no success. Andrew Poulson writing on Mr Excel encourages a contributor Snecz to compare his VBA mail merge .OpenDataSource statement against a Word macro recording. What do contributors think? My .OpenDataSource line seems standard. My Excel datasource file has a line of headers followed by two lines of data elements. We have Office 2010. I would be very grateful for any suggestions as to how to fix 4198 and if anyone knows of general diagnostic procedures. We are two people working for a charitable organisation. Any help welcome! Sub RunMerge() Dim wd As Object Dim wdocSource As Object Dim strWorkbookName As String On Error Resume Next Set wd = GetObject(, "Word.Application") If wd Is Nothing Then Set wd = CreateObject("Word.Application") End If On Error GoTo 0 Set wdocSource = wd.Documents.Open