Jump to content

Recommended Posts

Posted

Boa noite

Gostaria de saber de é possível e também como se faz para que um ficheiro criado com Excel 2003 não seja aberto pelo Excel 2007.

Obrigado

P.S. Sou novato no Forum...mas não posso deixar de manifestar o meu agrado pelos temas abordados. Parabéns.

Posted

Olá e Boa Noite

Obrigado pela prontidão...

Não queria fazer nada de especial, mas era uma dúvida na qual andava a "matutar" e até pensava que seria possível com VBA através de uma macro de abertura que  ao detectar o 2007 fizesse um "Application.Quit"...

Thanks

  • 2 weeks later...
Posted

Private Sub Workbook_Open()

Application.ScreenUpdating = False

Application.EnableCancelKey = xlDisabled

Dim RECEBE_VERSAO As Integer

Dim VERSAO_ATUAL As String

RECEBE_VERSAO = Application.Version

If Len(RECEBE_VERSAO) = 3 Then

  RECEBE_VERSAO = Left(RECEBE_VERSAO, 1)

Else

  RECEBE_VERSAO = Left(RECEBE_VERSAO, 2)

End If

If RECEBE_VERSAO = 12 Then

  VERSAO_ATUAL = "Excel 2007"

ElseIf RECEBE_VERSAO = 10 Then

  VERSAO_ATUAL = "Excel XP"

ElseIf RECEBE_VERSAO = 9 Then

  VERSAO_ATUAL = "Excel 2000"

ElseIf RECEBE_VERSAO < 9 Then

  VERSAO_ATUAL = "muita antiga!"

End If

If Val(Application.Version) <> 11 Then

  MsgBox ("Esse programa foi feito para ser executado no Excel 2003,") _

  & Chr(13) & Chr(13) & _

  ("e a sua versão é ") & VERSAO_ATUAL _

  & Chr(13) & Chr(13) & _

  ("O programa será fechado!"), (vbOKOnly), ("PAULO SEMBLANO")

  Application.ScreenUpdating = True

  ThisWorkbook.Close SaveChanges:=False

End If

Application.ScreenUpdating = True

End Sub

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.