• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Mac Excel Version of Macros

jwelker12

New Member
Hello I am having some issues with the following Macro only in the Mac Version of Excel for some reason. When i use the Macro in a windows version of Excel the macro works just fine. Does any one have any ideas that might help out with thi issue? Here is a copy of the file and the error that I'm getting.

Code:
Sub Auto_Open()
ExpirationCode
End Sub
Sub ExpirationCode()
Dim ExpirationDate As Date
ExpirationDate = DateSerial(2014, 11, 18)
If Now() >= ExpirationDate Then
MsgBox "Trial Period ended on " + CStr(ExpirationDate) + "."
ThisWorkbook.Close savechanges:=False
End If
End Sub
If you have any question about the situation please let me know.

Justin-
 

Attachments

  • Test.xls
    Test.xls
    36 KB · Views: 0
  • Screen Shot 2014-11-19 at 10.56.34 PM.png
    Screen Shot 2014-11-19 at 10.56.34 PM.png
    27.5 KB · Views: 2
  • Screen Shot 2014-11-20 at 8.54.50 PM.png
    Screen Shot 2014-11-20 at 8.54.50 PM.png
    60.4 KB · Views: 2
Last edited by a moderator:
Hi Justin ,

I don't have a Mac , so I cannot say , but on a hunch , does the keyword savechanges exist in the Mac ? Can you try :

ThisWorkbook.Close False

Narayan
 
Hi Justin ,

Does the method Thisworkbook.Close exist ?

When you type in thisworkbook and press the period symbol "." , does the Intellisense show the keyword Close in the available methods dropdown ?

What happens if you type in ThisWorkbook.Close in the Immediate window ? Do you get the same error ?

Narayan
 
Hi,
Test next!

Sub Auto_Open()
ExpirationCode
EndSub

Sub ExpirationCode()
Dim ExpirationDate AsDate
ExpirationDate = DateSerial(2014, 11, 18)
If Now() >= ExpirationDate Then
MsgBox "Trial Period ended on " + CStr(ExpirationDate) + "."
' no work with Mac => ' ThisWorkbook.Close savechanges:=False
Workbooks(ThisWorkbook.Name).Close SaveChanges:=False
EndIf
EndSub

' There were 'easy hint'. Small letters with Your 'right code'.
' ThisWorkbook.Close savechanges:=False
' That tells something is wrong
' (and it don't help even You change those to 'SaveChanges')
 
Back
Top