New Word.application Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and microsoft word 12.0 object library dll download policies of this site About Us Learn more about Stack Overflow the
Excel.workbook User-defined Type Not Defined
company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags microsoft word 12.0 object library download Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only
Vba Tools References Greyed Out
takes a minute: Sign up User defined type not defined- controlling Word from Excel up vote 0 down vote favorite I am trying to do some relatively simple copy and pasting from Excel 2007 into Word 2007. I've looked through this site and others, and keep getting hung up on the same thing- the third line n the code below keeps compile error in hidden module link mac giving me the "User type note defined" error msg. I am really confused since I just lifted this from another solution (and had similar issues with other solutions I tried to lift). Could someone please educate me on what is causing the error, and why? Sub ControlWord() ' **** The line below gives me the error **** Dim appWD As Word.Application ' Create a new instance of Word & make it visible Set appWD = CreateObject("Word.Application.12") appWD.Visible = True 'Find the last row with data in the spreadsheet FinalRow = Range("A9999").End(xlUp).Row For i = 1 To FinalRow ' Copy the current row Worksheets("Sheet1").Rows(i).Copy ' Tell Word to create a new document appWD.Documents.Add ' Tell Word to paste the contents of the clipboard into the new document appWD.Selection.Paste ' Save the new document with a sequential file name appWD.ActiveDocument.SaveAs Filename:="File" & i ' Close this new word document appWD.ActiveDocument.Close Next i ' Close the Word application appWD.Quit End Sub excel vba excel-vba ms-word excel-2007 share|improve this question edited Jul 31 '12 at 17:36 SeanC 11.2k52045 asked Jul 30 '12 at 20:13 T
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 Changelog Microsoft Graph API Office 365 Connectors Office 365
User Defined Type Not Defined Vba Excel
REST APIs SharePoint Add-ins Office UI Fabric Submit to the Office Store All Documentation
User-defined Type Not Defined Excel 2010
https://www.yammer.com/ http://feeds.feedburner.com/office/fmNx Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Answered by: microsoft word object library Compile Error: User-defined type not defined Microsoft Office for Developers > Access for Developers Question 0 Sign in to vote Hello all I'm trying to do a mail merge into Word. When I click on the http://stackoverflow.com/questions/11728899/user-defined-type-not-defined-controlling-word-from-excel button I'm getting the a Compile Error Please see the code below. Private Sub MailMergeButton_Click() On Error GoTo Err_MailMergeButton_Click Dim objwordApp As Word.Application Dim objWordDoc As Word.Document If AddressAlocationType = 3 Then Exit Sub Set objwordApp = CreateObject("objword.application") wordApp.Visible = True Select Case [AddressAlocationType] Case 1 Set objWordDoc = wordApp.Documents.Add("c:\database\W_L_G.dot") Case 2 Set objWordDoc = wordApp.Documents.Add("c:\database\W_L_P.dot") Case 3 https://social.msdn.microsoft.com/Forums/office/en-US/79a997cd-8352-4e2e-b0f7-b24462c89bd2/compile-error-userdefined-type-not-defined?forum=accessdev Exit Sub End Select Exit_MailMergeButton_Click: Exit Sub Err_MailMergeButton_Click: MsgBox Err.Description Resume Exit_MailMergeButton_Click End Sub Can someone be so kind to let me know what I'm doing wrong... Many thanks Thursday, November 10, 2011 1:04 PM Reply | Quote Answers 1 Sign in to vote You need to go in VBE windows, then menu Tools > References > then search for Microsoft Word xx.0 Object Library The xx is a Number, which can vary depending on which version of Office you have installed. To make use of the Word Object Library, you must have installed Word on your PC, I assume you have. You might use Late binding, to avoid using Word Object Library, but thats another topic. Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy" Marked as answer by bryan_rymer Thursday, November 10, 2011 3:26 PM Thursday, November 10, 2011 2:19 PM Reply | Quote All replies 1 Sign in to vote Forwhich line the compile error occurs? Have you added a reference to Microsoft Word Object Library? Thursday, November 10, 2011 1:09 PM Reply | Quote Moderator 0 Sign in to vote Thank you so much for your respond... please see the line below where
Forums Excel Questions VBA - Word.Application Compile Error Results 1 to 2 of 2 VBA - Word.Application Compile ErrorThis is a discussion http://www.mrexcel.com/forum/excel-questions/639989-visual-basic-applications-word-application-compile-error.html on VBA - Word.Application Compile Error within the Excel Questions forums, part of the Question Forums category; I am getting a "Complie Error: User-defined type not defined" I cannot http://www.wiseowl.co.uk/blog/s199/vba-link-applications.htm figure out why i am getting this error. ... LinkBack LinkBack URL About LinkBacks Bookmark & Share Digg this Thread!Add Thread to del.icio.usBookmark in TechnoratiTweet this thread Thread microsoft word Tools Show Printable Version Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Jun 5th, 2012,03:40 PM #1 SpeedyFingers New Member Join Date Mar 2012 Posts 38 VBA - Word.Application Compile Error I am getting a "Complie Error: User-defined type not defined" I cannot figure out why i am getting this error. Code: Sub Create_Letters() Dim objX type not defined As Object Dim rng1 As Range Dim rng2 As Range Dim wb As Workbook Dim wsControl As Worksheet Dim wsData As Worksheet ' Dim oApp As Word.Application Dim oBookMark As Word.Bookmark Dim oDoc As Word.Document ' Dim strDocumentFolder As String Dim strTemplate As String Dim strTemplateFolder As String Dim lngTemplateNameColumn As Long Dim strWordDocumentName As String Dim lngDocumentNameColumn As Long Dim lngRecordKount As Long ' not used but retain for future use ' Set wb = ThisWorkbook Set wsControl = wb.Worksheets("Control Sheet") wsControl.Activate Set wsData = wb.Worksheets(wsControl.[Data_Sheet].Value) strTemplateFolder = wsControl.[Template_Folder].Value strDocumentFolder = wsControl.[Document_Folder].Value wsData.Activate lngTemplateNameColumn = wsData.[Template_Name].Column lngDocumentNameColumn = wsData.[Document_Name].Column 'number of letters required: 'must not have any blank cells in column A - except at the end Set rng1 = wsData.Range(Cells(2, 1), Cells(Rows.Count, 1).End(xlUp)) lngRecordKount = rng1.Rows.Count ' 'Set oApp = CreateObject("Word Application") Set oApp = New Word.Application 'Process each record in turn For Each rng2 In rng1 strTemplate = strTemplateFolder & "\" & wsData.Cells(rng2.Row, lngTemplateNameColumn) strWordDocumentName = strDocumentFolder & "\" & wsData.Cells(rng2.Row, lngDocumentNameColumn) 'check that template exists If Dir(strTemplate) = "
Courses Microsoft Excel training + Excel training VBA (macros) Modelling in Excel Excel Power BI Power BI Desktop SQL Server training Writing SQL Integration Services Analysis Services Reporting Services Report Builder Programming courses T-SQL VBA macros C# Visual Basic DAX Business Intelligence SSRS SSAS (Tabular) SSAS (Cubes) SSIS Power BI Tools Go Wise Owl Training Blogs Referencing Word and other applications in Excel VBA Using VBA to Link Applications This page has 0 threads | Add post BLOGS BY TOPIC Blog home page (332) Excel + (112) SQL Server (144) Programming (138) General (22) Archived (70) BLOGS BY AUTHOR Andrew Gould (81) Andy Brown (235) David Wakefield (3) Jenny Brown (1) Michael Allsop (12) BLOGS BY YEAR 2010 (2) 2011 (76) 2012 (100) 2013 (45) 2014 (38) 2015 (23) 2016 (48) Referencing Word and other applications in Excel VBA Part three of a four-part series of blogs Even if you're writing Visual Basic macros within Excel, there's nothing to stop you inserting text into Word documents, manipulating PowerPoint slides or sending Outlook emails. This blog explains how to reference other applications, and write macros in Excel to link to other Microsoft Office software Creating References to Other Applications in VBA Using Tools References to Create a Reference to Word Using VBA to Link Applications (this blog) Using Bookmarks to Fill in a Word Document from Excel This blog is part of a complete Excel VBA tutorial. You can also learn to program in VBA on one of our VBA macros courses.
Posted by Andy Brown on 05 December 2011 You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or d