Paulsondav
New Member
- Joined
- May 22, 2016
- Messages
- 1
Hey,
I've scowered the internet for a solution but have come up empty with an answer I can actually understand. I've had a little cross over trouble with the code below. Although this works perfectly on my PC I found out the Workbook will mainly be used on a MAC which I really have no experience with. It seems that on a MAC the folderpath must be different and keeps coming back with an error saying it cannot find the file path. On the Function open Part I also use the same Filepath call but before it even gets to that it hits a runtime error while setting objWord. Any help on this is much appreciated. Thanks.
Sub ExpandRecords()
Dim folderPath As String
ActiveWorkbook.SaveCopyAs Filename:=folderPath & "\Data.xls"
Call FnOpeneWordDoc
End Sub
Function FnOpeneWordDoc()
'Finds Desktop Path and Opens Mail Template
Dim objWord
Dim objDoc
Dim folderPath As String
folderPath = Application.ActiveWorkbook.Path
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open(folderPath & "\Mail Template.docm", ReadOnly:=False)
objWord.Visible = True
objWord.Run "Mail_Merge"
End Function
I've scowered the internet for a solution but have come up empty with an answer I can actually understand. I've had a little cross over trouble with the code below. Although this works perfectly on my PC I found out the Workbook will mainly be used on a MAC which I really have no experience with. It seems that on a MAC the folderpath must be different and keeps coming back with an error saying it cannot find the file path. On the Function open Part I also use the same Filepath call but before it even gets to that it hits a runtime error while setting objWord. Any help on this is much appreciated. Thanks.
Sub ExpandRecords()
Dim folderPath As String
ActiveWorkbook.SaveCopyAs Filename:=folderPath & "\Data.xls"
Call FnOpeneWordDoc
End Sub
Function FnOpeneWordDoc()
'Finds Desktop Path and Opens Mail Template
Dim objWord
Dim objDoc
Dim folderPath As String
folderPath = Application.ActiveWorkbook.Path
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open(folderPath & "\Mail Template.docm", ReadOnly:=False)
objWord.Visible = True
objWord.Run "Mail_Merge"
End Function