Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
  • Avatar do usuário
  • Avatar do usuário
Por EvandroRodrigues
Posts
#4875
Bom dia!
Criei uma macro para gerar um relatório. Ela está funcionando bem, o problema é que quando outro usuário executa a macro, ela não funciona.
Acredito que o problema está no caminho utilizado para salvar o relatório:
c:\users\Evandro\desktop..........
Existe uma maneira de deixar o caminho genérico, para que seja salvo na área de trabalho de cada usuário?
Avatar do usuário
Por alexandrevba
Avatar
#4880
Boa noite!!

Tente pegar o caminho activo.
Código: Selecionar todos
ThisWorkbook.Path & "\NomeArquivo.xls" 
Att
Avatar do usuário
Por Reinaldo
Avatar
#4883
Experimente utilizar a função disponibilizado no link http://www.ozgrid.com/forum/showthread.php?t=24985
Sintaxe: SpecialfolderPath & "\" & NomeDoArquivo
Código: Selecionar todos
Function SpecialFolderPath() As String
     
    Dim objWSHShell As Object
    Dim strSpecialFolderPath
     
     'On Error GoTo ErrorHandler
     ' Create a shell object
    Set objWSHShell = CreateObject("WScript.Shell")
     ' Find out the path to the passed special folder,
     '  just change the "Desktop" for one of the other options
    SpecialFolderPath = objWSHShell.SpecialFolders("Desktop")
     ' Clean up
    Set objWSHShell = Nothing
    Exit Function
ErrorHandler:
     
    MsgBox "Error finding " & strSpecialFolder, vbCritical + vbOKOnly, "Error"
End Function
Por TuckaCabral
#4903
Utilize a função ENVIRON ("USERPROFILE").
Ela vai pegar o caminho do desktop do usuario que estiver logado.
Mto boa... pode ser usada tambem pra definir permissoes de uso, mas dai seria usando USERNAME ao inves de USERPROFILE.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord