SaveAs, PC and Mac

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
 
H

Helmut Weber

Hi Senad,
it is:
FileFormat:=wdFormatDocument
I don't know why it doesn't work.
I think, if you don't have to save once
in this format and another time in that,
you could just omitt fileformat.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top