Desative o sinal de aviso

2

Existe alguma maneira de impedir que este aviso surja no Microsoft Access 2007-2013 via método VBA? Eu tentei (DoCmd.SetWarnings False) e (Application.DisplayAlerts = false)

Aparentemente, o método não funcionou. Qualquer ajuda será muito apreciada.

    
por Ky TySon 16.09.2016 / 04:41

1 resposta

3

Confira o Método CopyFile e considere usar o overwrite argumento para passar para a função para informar que, se o arquivo existir, sobrescreva-o e não solicite.

Visual Basic for Applications Reference

CopyFile Method

Syntax

object.CopyFile source, destination[, overwrite]

The CopyFile method syntax has these parts:

  • Part: overwrite

    • Description: Optional. Boolean value that indicates if existing files are to be overwritten. If True, files are overwritten; if False, they are not. The default is True. Note that CopyFile will fail if destination has the read-only attribute set, regardless of the value of overwrite.

Remarks

Wildcard characters can only be used in the last path component of the source argument. For example, you can use:

FileSystemObject.CopyFile "c:\mydocuments\letters\*.doc", "c:\tempfolder\"

But you can't use:

FileSystemObject.CopyFile "c:\mydocuments\*\R1???97.xls", "c:\tempfolder"

If source contains wildcard characters or destination ends with a path separator (), it is assumed that destination is an existing folder in which to copy matching files. Otherwise, destination is assumed to be the name of a file to create. In either case, three things can happen when an individual file is copied.

  • If destination does not exist, source gets copied. This is the usual case.
  • If destination is an existing file, an error occurs if overwrite is False. Otherwise, an attempt is made to copy source over the existing file.
  • If destination is a directory, an error occurs.

An error also occurs if a source using wildcard characters doesn't match any files. The CopyFile method stops on the first error it encounters. No attempt is made to roll back or undo any changes made before an error occurs.

Origem

    
por 16.09.2016 / 05:17