S
Senad Isanovic
I'm trying to create a save as function that will work on both PC and Mac.
The code below works fine on PC but when I run it on the Mac something goes
wrong on the ActiveDocument.SaveAs line. I'm not sure if it is the Mac file
format or the path or something else that is not working. Can you please
give me some advice?
Sub saveDocNetwork1()
Dim sC_DOCUMENTSPATH As String, C_DOCUMENTSPATH1 As String,
C_DOCUMENTSPATH2 As String
On Error GoTo Avbryt
C_DOCUMENTSPATH = Options.DefaultFilePath(wdDocumentsPath)
If UCase(Left(fOpSys, 3)) = "WIN" Then
C_DOCUMENTSPATH1 = "C:\tmp\windowsupdate"
Else
If UCase(Left(fOpSys, 3)) = "MAC" Then
C_DOCUMENTSPATH1 = "Macintosh HD:tmp:windowsupdate"
End If
End If
If ActiveDocument.Saved = False Then
ActiveDocument.Save
End If
ActiveDocument.SaveAs FileName:=C_DOCUMENTSPATH1 &
Application.PathSeparator & ActiveDocument.Name, _
FileFormat:=wdFormatDocument, LockComments:=False, Password:="", _
AddToRecentFiles:=True, WritePassword:="",
ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False,
SaveFormsData _
:=False, SaveAsAOCELetter:=False
Exit Sub
Avbryt:
MsgBox Err.Description & vbCrLf & "Felnummer: " & Err.Number
End Sub
Function fOpSys() As String
Dim sOpSys As String
sOpSys = System.OperatingSystem
fOpSys = sOpSys
End Function
The code below works fine on PC but when I run it on the Mac something goes
wrong on the ActiveDocument.SaveAs line. I'm not sure if it is the Mac file
format or the path or something else that is not working. Can you please
give me some advice?
Sub saveDocNetwork1()
Dim sC_DOCUMENTSPATH As String, C_DOCUMENTSPATH1 As String,
C_DOCUMENTSPATH2 As String
On Error GoTo Avbryt
C_DOCUMENTSPATH = Options.DefaultFilePath(wdDocumentsPath)
If UCase(Left(fOpSys, 3)) = "WIN" Then
C_DOCUMENTSPATH1 = "C:\tmp\windowsupdate"
Else
If UCase(Left(fOpSys, 3)) = "MAC" Then
C_DOCUMENTSPATH1 = "Macintosh HD:tmp:windowsupdate"
End If
End If
If ActiveDocument.Saved = False Then
ActiveDocument.Save
End If
ActiveDocument.SaveAs FileName:=C_DOCUMENTSPATH1 &
Application.PathSeparator & ActiveDocument.Name, _
FileFormat:=wdFormatDocument, LockComments:=False, Password:="", _
AddToRecentFiles:=True, WritePassword:="",
ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False,
SaveFormsData _
:=False, SaveAsAOCELetter:=False
Exit Sub
Avbryt:
MsgBox Err.Description & vbCrLf & "Felnummer: " & Err.Number
End Sub
Function fOpSys() As String
Dim sOpSys As String
sOpSys = System.OperatingSystem
fOpSys = sOpSys
End Function