I've developed a macro on Windows that works perfectly, I had a problem with the opening of files - now I have a problem saving the file. Here is the code tossing the error:
The error I get is when I run on a Mac, it says:
"Compile error:
User-defined type not defined."
And the debugger has the Function GetFolder(strPath...) highlighted.
I have no idea what the problem is, it was working just fine in Windows - anyone have any suggestions?
Code:
Sub asktosave()
Dim sav As Integer
Dim file_name As Variant
sav = MsgBox("Would you like to save this file?", 4, "Save?")
If sav = vbYes Then Call GetFolder("Select Folder Location")
End Sub
Function GetFolder(strPath As String) As String
Dim sItem As String
Dim sFile As String
Dim fldr As FileDialog
Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
With fldr
.Title = "Select a Folder"
.AllowMultiSelect = False
.InitialFileName = strPath
If .Show <> -1 Then GoTo NextCode
sItem = .SelectedItems(1)
End With
NextCode:
GetFolder = sItem
Set fldr = Nothing
sFile = "\" & sSubID & "-" & sSubSession & "-synced.txt"
ActiveWorkbook.SaveAs Filename:=sItem & sFile, FileFormat:=xlTextMSDOS, CreateBackup:=False
End Function
The error I get is when I run on a Mac, it says:
"Compile error:
User-defined type not defined."
And the debugger has the Function GetFolder(strPath...) highlighted.
I have no idea what the problem is, it was working just fine in Windows - anyone have any suggestions?