word-vba

Converting MS Word 2002 Templates from PC to Mac

馋奶兔 提交于 2019-12-12 12:17:14
问题 I have to convert several hundred MS Word 2002 Templates (on the PC) to work on the Macintosh. I have to evaluate whether the Word Templates can be run in iWork Pages and Microsoft Word for the Mac. I am unable to convert the following: Word VBA WordBasic code Visual Basic Has anyone here done this and can provide any suggestions? 回答1: iWork would be very difficult, but Word for Mac is doable. It also depends on which version of Word for Mac - the Office 2008 version doesn't have VBA, only

getting save as file name in word

不打扰是莪最后的温柔 提交于 2019-12-12 10:45:50
问题 In the code below the file name is hard coded, but I want the user to be able to pick it. I was reading about GetSaveAsFilename but I get an error when using it: "method or member not found". fileSaveName = Application.GetSaveAsFilename _ (fileFilter:="Excel Files (*.txt), *.txt") This is written for Word 2010. Am I wrong in thinking GetSaveAsFilename is available in word VBA? Sub Macro3() ' ' Macro3 Macro ' ' ActiveDocument.SaveAs2 FileName:="Questionnaire01-05-20122.txt", _ FileFormat:

Macro is disabled by word confidentiality

ぐ巨炮叔叔 提交于 2019-12-12 10:25:04
问题 I'm trying to create a macro that PopUp a toolBar containing button for a specific action but the code works fine and I tested every single line but when I run it a message from word PoPUP and prevent me to run this and I donno why PS : I tried every signle solution in Google and forums and I'm working with Word 2016 and word 2007 this is My code Sub AddNewMB() Dim myCommandBar As CommandBar, myCommandBarCtl As CommandBarControl Dim myCommandBarSubCtl As CommandBarControl On Error GoTo

Get all cross references in word with VBA

一个人想着一个人 提交于 2019-12-12 09:06:12
问题 I have quite a large word document (> 400 pages) with lots of cross references to headings. So far, I have always referred to the title of the heading, but now I would like to change that and refer to the page the heading resides on. I didn't find a solution to this via the GUI (except manual treatment, of course), so I was looking into writing some VBA. Unfortunately, I have only found a way to list all targets that can be cross referenced (via GetCrossReferenceItems ), but I need a way to

Using base64 data stored in CustomXMLPart as image in Office

前提是你 提交于 2019-12-12 07:38:15
问题 As a followup to this question about using images stored in an Excel file on a button in the ribbon: Is it possible to use an image stored in a CustomXMLPart/CustomXMLNode in base64-encoded string as an image in an Office document without first saving it to disk and loading it back? The place where I want to use the image takes an IPictureDisp object as a parameter (like the LoadPicture function returns, but that will only load files from disk). 回答1: First you need to convert your base_64

How to optimize a VBA Macro that adds a link to multiple Arabic words at once

孤街醉人 提交于 2019-12-12 07:07:03
问题 Building upon the response I receive to my previous question here, I want to create a macro to add one link to multiple Arabic words. Example: if I have a text that has: horse or horses or pony , I need to link it to horses.com . I was able to modify the original macro to add links to all of the three words successfully, but I believe that my code is bloated with repetition. My question is: is there a way to condence the code with better expressions? Here is my working code so far: Sub

Changing numbering in word using VBA

假装没事ソ 提交于 2019-12-12 05:48:44
问题 I have a document in which several questions are there. Now, there are couple of additions in the document. I have to now sit and change each and every question number. Also, There are certain skip pattern. For example: "If 2 coded in Q5 then, go and ask Q6 else skip to Q10 " Now, if I change the numbering of the questions. I becomes really difficult to map and change the routing questions. Manually, It takes too much time. Please help me if there is any way through VBA or any method to

Insert a new page in word without header

别来无恙 提交于 2019-12-12 05:29:18
问题 I am trying to insert a new page in word i.e insert a section break. The problem is that i want to change this page to A3 landscape and remove all headers, which my code currently does not do. How to modify my code below to achieve this? Below is my current code that insert new page, but keeps the header and a4 portrait: If wordDrawingExist Then Selection.EndKey Unit:=wdStory Selection.InsertFile FileName:=wFile, link:=False Set wb = Documents.Open(wFile) Selection.WholeStory Selection.Copy

Deploy Dotm File with format styles?

大兔子大兔子 提交于 2019-12-12 05:28:37
问题 I have developed a small VBA macro for Word 2007 / 2010 which uses some format styles (I am not sure that is the best translation, in my german version it is called Formatvorlagen. I mean the styles which are applied to text, like headers). The macro is deployed to the STARTUP Folder and essentially works - but the format styles are NOT loaded - so the macro cannot find them. So my question is: how can I deploy format styles to Word? I could overwrite normal.dot, but that is a crappy solution

word vba: get position of an ActiveX control within a table

陌路散爱 提交于 2019-12-12 05:16:59
问题 I want to get the position (row & column) of a ActiveX button, placed in a table. So far I know only how to get a hand on the button Selection.Fields.Item(1).OLEFormat.Object all ActiveX Controls are listed in Me.Content.InlineShapes It seems that I can access the parent table via selection.tables.item(1) but I don't how to determine the position of the button within that table, e.g. c5r8 回答1: I used the following code to test my theory progressively. It turned out correct. Private Sub TestAX