word-vba-mac

Word macro behaves different on macOS

爱⌒轻易说出口 提交于 2020-01-25 10:19:06
问题 I've written a small programm in MS Word VBA that is working perfectly fine for all windows machines I've deployed it to. However the computers running macOS seem to have trouble with it. In a collection I always store an array as value and give it a unique key. These arrays always contain a sequence (like 'a\') at index 0 and up to 5 combining diacritical marks. These diacritical marks, such as the accent grave (on the à for example), are stored via their numerical value, in this case '0300'

Multi-dimensional array in VBA for Microsoft Word on Mac

夙愿已清 提交于 2019-12-25 03:33:00
问题 I'm working on a macro to loop through a series of strings ( a1, a2, a3 ) and replace them with a series of corresponding values ( b1, b2, b3 ). I've created an array to store the strings to match: Dim search_strings(1 To 2) As String search_strings(1) = "match1" search_strings(2) = "match2" I can loop through this array with a For Each loop. But I can't figure out how to store and reference the corresponding replacement text. I know that I need some sort of key/value pair. I've tried using a

Word 2016 vba add-in for Mac

这一生的挚爱 提交于 2019-12-24 06:45:07
问题 I have an created an add-in for Word which communicates with a third party cmd-program via an api I have written in c# using visual studio. The communication takes place using stdin and stdout. The program works for word 2007, 2010, 2013, 2016 for Windows. I have also successfully ported it to Word 2011 for Mac. The api here is written in c using xcode, but still using stdin and stdout. The api on mac is a dylib, which I can reference in the visual basic editor. I'm having trouble replicating

Sending and receiving data via POST in Microsoft Word 2011 for OSX

試著忘記壹切 提交于 2019-12-14 04:27:27
问题 I am trying to port a macro that we have working for MS Word on Windows that uses a website to generate an equation image and returns that image for insertion into a document. The current (working on Windows) call is below. When I use the same call in OSX, I receive an error 429 stating "ActiveX component can't create object". ' Create an xmlhttp object. Set w_page = CreateObject("Microsoft.XMLHTTP") ' Open the connection to the remote server. w_page.Open "POST", WebAdd, False ' Indicate that

open word doc with excel 2016 button on mac

[亡魂溺海] 提交于 2019-12-13 05:17:51
问题 I am trying to use this code with a button to open a word doc in excel 2106 on a mac running high sierra: Sub buttontest1() Dim objdoc As Object FileName = "/Volumes/256SSD/word docs/shortcut keys.docx" With CreateObject("word.application") Set objdoc = .documents.open(FileName) End With Set objdoc = Nothing End Sub The first time I run this, it works fine. I then close the word doc (command q) and run it again but I get a runtime error -2146959355 (80080005) and a blank word doc opens. I

How can I determine if my VB code is running on Office 2016 for Mac?

二次信任 提交于 2019-12-07 12:30:52
问题 Is there a conditional that I can use to differentiate if my Macro is running on Office 2016 for Mac or Office for Mac 2011 回答1: In Office 2016 for Mac, there is a new conditional called MAC_OFFICE_VERSION to test which VB version the user is running. The following example shows how it to use it in your code: Sub VersionConditionals() #If MAC_OFFICE_VERSION >= 15 Then Debug.Print "We are running on Mac 15+" #Else Debug.Print "We are not running on Mac 15+" #End If #If Mac Then Debug.Print "We

How can I determine if my VB code is running on Office 2016 for Mac?

て烟熏妆下的殇ゞ 提交于 2019-12-05 20:02:53
Is there a conditional that I can use to differentiate if my Macro is running on Office 2016 for Mac or Office for Mac 2011 In Office 2016 for Mac, there is a new conditional called MAC_OFFICE_VERSION to test which VB version the user is running. The following example shows how it to use it in your code: Sub VersionConditionals() #If MAC_OFFICE_VERSION >= 15 Then Debug.Print "We are running on Mac 15+" #Else Debug.Print "We are not running on Mac 15+" #End If #If Mac Then Debug.Print "We are running on a Mac" #Else Debug.Print "We are not running on a Mac" #End If End Sub Note: The "#If Mac"

MS Word Macro to increment all numbers in word document

烂漫一生 提交于 2019-11-29 17:44:43
I am trying to make a MS-word Macro to increment all numbers in the word document which are within brackets, eg original numbers [1] [2] [3] [4] , after incrementing all numbers by 10, above numbers will be changed to [11] [12] [13] [14] I'm stuck in the code below and not familiar with VBA before. Can anyone suggest, what to add in code below to perform above macro?? Sub IncrementNumbers() ' ' IncrementNumbers Macro ' ' Application.ScreenUpdating = False Dim RngStory As Range, StrStart As String, StrEnd As String StrStart = "[" StrEnd = "]" Set RngStory = ActiveDocument.Range With RngStory

MS Word Macro to increment all numbers in word document

Deadly 提交于 2019-11-28 11:57:39
问题 I am trying to make a MS-word Macro to increment all numbers in the word document which are within brackets, eg original numbers [1] [2] [3] [4] , after incrementing all numbers by 10, above numbers will be changed to [11] [12] [13] [14] I'm stuck in the code below and not familiar with VBA before. Can anyone suggest, what to add in code below to perform above macro?? Sub IncrementNumbers() ' ' IncrementNumbers Macro ' ' Application.ScreenUpdating = False Dim RngStory As Range, StrStart As

How to save a Unicode character to a text file

旧时模样 提交于 2019-11-28 05:59:39
问题 This is in Word for MAC VBA. I want to save the Unicode character from a text box to text file. For example this character "⅛". I use this code. Dim N as Long N = FreeFile Dim strText as String strText = Textbox1.Text 'This is what is in the textbox "⅛" Open <file path> For Output As N Print #N, strText Close N It does not save the Unicode character. I understand I have to change the text encoding format. How do I do that? Likewise, how to read the text file with the Unicode format? 回答1: I