word-vba

Delete all Paragraph Marks except bullets, using Range

浪尽此生 提交于 2019-12-10 12:16:22
问题 I need to delete all paragraph marks of ActiveDocument except: The one which is having Bold-Font after. (Example is in picture, attached) Bullet-Point paragraph marks. By using Ranges I came up with the following Code. It works well, but it is not detecting the bullet points. What should I do? I am beginner to use Ranges . Sub PARAGRAPHSmark() Dim PARA As Range Dim p As Range Set PARA = ActiveDocument.Range PARA.MoveEnd wdCharacter, -1 Do Set p = PARA.Duplicate p.Find.Execute "^13" PARA.Start

Late binding to avoid “User defined type not defined” error

我们两清 提交于 2019-12-10 12:05:22
问题 In Word 2010 macro VBA, i set Set objXML = New MSXML2.DOMDocument30 to get xml type Word.officeUI file. But when i call the sub that handling Word.officeUI file user defined type not defined error rised. I don't want to add any necessary .dll or another source from TOOLS > REFERENCES I need to add any thing in run time (first opening of Word). Here is my actual code in use at below, ' bu özel sub sadece onLoad event'ına karşılık gelen ve belge ilk defa yüklendiğinde çalışan özel bir sub

Microsoft Word Mail Merge Data Source auto location

萝らか妹 提交于 2019-12-10 11:15:09
问题 I have written an Excel > Word Mail merge where the word document is the mail merge template. At the moment the location of the excel file (data source) has to be hard coded. I want to be able to move the files about the network, as long as they are in the same folder as each other, so it recognizes the data source is still the excel file. I currently have this piece of code which i thought would work. When the word document is opened at any point, it will re-create the data source by looking

Implement auto-increment with Word macro

陌路散爱 提交于 2019-12-10 10:26:15
问题 I'm writing a Word/VBA macro for a document template. Every time a user saves/creates a new document from the template, the document needs an ID embedded in the text. How can I (as simple as possible) implement auto-increment for this ID? The ID is numeric. The system has to have some kind of mechanism to avoid different documents getting the same IDs, but the load is very low. About 20 people will use this template (on our intranet), creating something like 20 new documents a week altogether

creating tables in MS Word using VBA

我怕爱的太早我们不能终老 提交于 2019-12-10 10:05:47
问题 What are the codes to create a table in MS Word? I've used the record function for macro to see how it is written and i have no idea how to interpret this. and can you not draw tables while recording a macro? It greys out the "draw table" function. I need to make a talbe that has some merged cells within the table - it would be easier if i can draw the table and record using macro but it seems like i can't do that... I've used the draw function to draw the follow table but i can't record it.

Run external vba-code in MS Word

╄→гoц情女王★ 提交于 2019-12-10 04:56:56
问题 Can I link in external code to a Word document? I have a lot of word documents with macros (VBA-code). All with the same code. I would like the code to be run from an external source instead of from within all of those documents. That way, if I have to update the code, I only have one place where I have to do the update. 回答1: Move the code to the attached template , then the macros are available in all documents based on that template. 回答2: You can create a template and put it in the %APPDATA

Storing arbitrary meta-data in Microsoft Word document

让人想犯罪 __ 提交于 2019-12-09 12:35:00
问题 I need to store custom meta-data in a Word document. The 'document properties' are limited to 255 bytes but I have data which is >> 10k We are using VBA to write a word extension to interact with our application and want to have our application data stored in the word document. The idea is that that the user can share just the word document without sharing any other data files of our application. Has anyone ideas how to store arbitrary meta-data efficently in Office 2003+ documents? 回答1: Just

How do I return multi select listbox values into a sentence using Word VBA?

天涯浪子 提交于 2019-12-08 22:12:30
I've created a multi select listbox on a userform. There are 9 items in the listbox. How do I gather those selected items into a sentence? The listbox contains reasons for returning a check. The items in the listbox are idenfiers or placeholders for a longer string, so the selection "unsigned", creates the returned string, "the check was not signed". The user can select several reasons, so depending on the selections, I need sentence structure that formats as: "x, y, and z" OR "y and z" OR "z". (ex: "the check is not signed, the check is post-dated, and the check is a third-party check.") It

How can I compare Word Interop objects for “reference equality” AND determine collection or parent object to which, say, a paragraph belongs?

拟墨画扇 提交于 2019-12-08 19:16:55
问题 I would like to be able to: compare Word Interop COM proxies on a "reference equality" basis; and map from a specific object (say a paragraph) to the collection it comes from, OR at least determine whether two paragraphs are from the same section and which one comes relatively before the previous one Why do I want to do this? I am trying to build a Word Add-In that acts similarly to a spell-checker in the sense that it runs in the background (by background I mean by regularly stealing time

How to Jump to a Bookmark in Word-VBA and insert text?

天涯浪子 提交于 2019-12-08 16:35:32
问题 I am trying to create a Word document with a very simple word macro. The macro searches for a bookmark that I have placed in the text and then adds a date, 2 weeks into the future, at that location. But when I create a new document from the template I keep getting bookmark not found. I have been through it loads of times and sometimes the bookmark is there, sometimes its there but not allowing you to click "Go to". How can I get it to work? I have added a little piece of code to the Document