msword

Profiling VBA code for microsoft word

I have some legacy code that uses VBA to parse a word document and build some XML output; Needless to say it runs like a dog but I was interested in profiling it to see where it's breaking down and maybe if there are some options to make it faster. I don't want to try anything until I can start measuring my results so profiling is a m...

VSTO: Why is OfficeRibbon.Context null?

I'm developing my first Word 2007 addin, and I've added an OfficeRibbon to my project. In a button-click handler, I'd like a reference to either the current Word.Document or Word.Application. I'm trying to get a reference via the OfficeRibbon.Context property, which the documentation says should refer to the current Application object. ...

Convert .doc to html in php

Has anyone found a good class, or other file that will convert a .doc file into html or something that I can read and turn into html? I have been looking around for a couple hours now and have only found ones that require msword on the server in order to convert the file. I am pretty sure that is not an option but I have not actually t...

when copy/paste 'hello' from Word into textarea it becomes 018hello 019 after saving

Hi, I have in Word ‘hello’ and when I paste it I get 018hello 019 so the apostrophes turn into these strange characters. The type of web application should not matter as the behaviour is different depending on the workstation I use. I checked with Notepad, Excel and Wordpad and this issue does not occur, only for Word. It should be a...

Word Automation using WIN32OLE

I am trying to insert an image (jpg) in to a word document and the Selection.InlineShapes.AddPicture does not seem to be supported by win32old or I am doing something wrong. Has anyone had any luck inserting images. ...

How to hook keypress event in a Word shared add-in?

I need to be able to get all keypress events before they are passed up to the Word document. I want to do special handling of the keys and depending on what mode the add in is in, the keys may or may not be sent to the Word document. I only want the keypress events that belong to the document, I don't want to hook events for popup wind...

Embed word document into ASP.net page and access using VBscript

Hi, I have some code that opens a word document using VBScript on an ASP.net page: set objWord = CreateObject("Word.Application") objWord.Visible = True objWord.Documents.Open "c:\inetpub\wwwroot\JSWordTest\test.doc", False, False, False This works great but opens the word doc in another window. Ideally I would like to make this look...

How can I find out what a macro does without exposing myself to it?

I have been given two different Microsoft Word document that my virus scanner has warned me contains macros. These should be simple text files, and the person who sent them doesn't even know what a macro is; they may be a mistake on his part, but they might be signs of a malicious infection. My installation of OpenOffice.org is set not t...

How do I create an OLE Control ?

Without going into why I need OLE.. I need to embed a managed C++ custom control into MS Word 2007 (2003 also would be nice). So the question is How do I make this managed (.net 3.5) control OLE compliant ? It seems that I need to do something akin to implementing an interface. But an up-to-date tutorial is something that is proving d...

VBA event for document edited.

Is there an event for when a document is edited? If not does anyone know where I could find a list of the VBA events available? ...

How to call a Macro in Microsoft Word 2003

I need to reinforce the structure of a Microsoft Word document. EG: Style Question here blah blah blah Style Answer Here blah blahblah The enforcement here would be the "Answer" style cannot be placed unless there is a "Question" style above it. To do this I would use a Macro, so ideally I would like to call my Macro everytime the doc...

Moving data from Word to Access seamlessly

I am trying to migrate structured documents (i.e. documents that are mostly some metadata and one big table) to a database. When I try to move tabular data from Word to Excel, my main point of pain is handling CRLFs within a cell in Word. Any solution for this? Now, since I will be transferring from Word to Access: What will be the de...

Getting the headings from a Word document

How do I get a list of all the headings in a word document by using VBA? ...

Tool to merge MS Word files

I have huge number of Word files I need to merge (join) into one file, and will be time consuming to use the Word merger (one by one). Have you experienced any tool that can handle this job? ...

Hyperlink that will open document using DAV protocol?

I have a DAV server (Oracle Portal in this case). If I open word and then enter the DAV URL of a document, I'm correctly prompted for username/password and the document is checked out. I can edit it and just click Save to save it back to the server. So far, so good. What I need is a link on a web page that will open the document for edi...

Pasting source code in word 2007

If i try to paste source code in word 2007 the spacing between the lines seems to get messed up as all new lines are spaced way apart compared to a programming text editor. Can somebody tell me how to paste source code in word 2007 preserving the formatting and the spacing between lines? ...

Splitting word documents with macros

I have a word document that starts with a table of context. I need to break up the document into sections based on the table of context. The table of context has a section title and section number. How can I use macros to split the document based on the section numbers/ name? ...

How do I read the value of a checkbox in a word (*.doc) file in VB.net using a Range object?

How do I read the value of a checkbox in a word (*.doc) file in VB.net using a range object? This is what I have so far: Dim app As New Word.Application Dim doc As Document doc = app.Documents.Open("C:\myDoc.doc") dim chkBox as Bookmark chkBox = doc.Bookmarks("MyCheckbox") Dim rng as Range rng = chkBox.Range where "MyCheckbox" is the...

Problems casting an ComObject in VB.net

I have a Word.Field object which is a checkbox and the Type property equals wdFieldFormCheckBox. I am trying to cast the Word.Field object as Word.CheckBox object but I am getting casting errors. Dim chkBox as Word.CheckBox chkBox = DirectCast( myFieldInstance, Word.Checkbox) How do I cast a Word.Field object into Word.CheckBox objec...

Export to Word Document in C#

I'm looking for a .NET library that will allow creation of a Word document. I need to export HTML based content to a Word doc (97-2003 format, not docx). I know that there are the Microsoft Office Automation libraries and Office interop, but as far as I can tell, they require that you have office actually installed and they do the conv...