Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-30-2020, 04:00 AM
reynoldsrjr reynoldsrjr is offline Code on a button to attach a document to my Word Auto fill document is not working on a Mac Windows 10 Code on a button to attach a document to my Word Auto fill document is not working on a Mac Office 2016
Novice
Code on a button to attach a document to my Word Auto fill document is not working on a Mac
 
Join Date: Mar 2020
Location: Falls Church Virginia
Posts: 1
reynoldsrjr is on a distinguished road
Default Code on a button to attach a document to my Word Auto fill document is not working on a Mac

Hello
I designed a Word document that gives users the option to select a button so that they can select a document and once selected, the document will be attached. This works fine on a PC. However, on a Mac it does not work. I have been investigating this issue for days now and the code below is the code on the button.
Dim MyPath As String
Dim OneFile As Boolean
OneFile = True
MyPath = MacScript("return (path to desktop folder) as String")
If Val(Application.Version) < 15 Then
If OneFile = True Then
MyScript = _
"set theFile to (choose file of type" & _
" " & FileFormat & " " & _
"with prompt ""Please select a file"" default location alias """ & _
MyPath & """ without multiple selections allowed) as string" & vbNewLine & _


"return theFile"
End If
Else
If OneFile = True Then
MyScript = _
"set theFile to (choose file of type" & _
" " & FileFormat & " " & _
"with prompt ""Please select a file"" default location alias """ & _
MyPath & """ without multiple selections allowed) as string" & vbNewLine & _
"return posix path of theFile"
End If
End If
MyFiles = MacScript(MyScript)
FileName:=MyFiles, _
LinkToFile:=False, _
DisplayAsIcon:=True, _
IconLabel:=Right(MyFiles, Len(MyFiles) - InStrRev(MyFiles, "/"))
I do not have a Mac so when I sent a test form with this code on a button to a user with a Mac it is still failing. On a PC as I mentioned it works fine. The user selects a document and the document attaches as a icon. Is there any way this can be done on a Mac. Any help would be greatly appreciated. Also should I use AppleScriptTask instead of MacScript. Thanks in advance.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code on a button to attach a document to my Word Auto fill document is not working on a Mac PRINT field code in Word document not working as expected smccaffr39 Word 3 02-19-2020 02:46 PM
Button with VBA to attach a file in a protected document wolfgrrl Word VBA 6 09-20-2019 07:38 AM
Best way to attach a Word document to Outlook Reply message mitjad Office 4 04-09-2019 03:55 PM
Code on a button to attach a document to my Word Auto fill document is not working on a Mac Word type document auto fill in Sircooks Excel 5 05-14-2016 05:01 AM
File Not Found error when trying to attach Word document to email Kimber Word 0 03-06-2015 06:47 PM

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 02:49 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft