Share workbook with VBA

Asked

Viewed 1,247 times

-2

I need to share a workbook on the network, but when running the code the file goes to the folder C:\Documents\.

What would be the solution to this problem?

Private Sub btExecuta_Click()
    Dim NovoNomeArquivo As String
    Dim vPlan           As Worksheet

    Application.DisplayAlerts = False

    '- Remover o Compartilhamento
    On Error Resume Next
    ActiveWorkbook.ExclusiveAccess '- Acesso Exclusivo
    On Error GoTo 0

    Application.DisplayAlerts = True

    '- Mesclar Celulas
    ActiveSheet.Range("B3:C7").Merge

    '-- SALVA CÓPIA DA PLANILHA EM DETERMINADO PERIODO

    '-- Salva Pasta de trabalho antes de duplicar
    ActiveWorkbook.Save

    '-- Verifica o caminho onde esta salvo a pasta de trabalho
    NovoNomeArquivo = ActiveWorkbook.Path & "\" & Mid$(ActiveWorkbook.Name, 1, Len(ActiveWorkbook.Name) - 5) _
                    & " - " & Format(Date, "yyyy-mm-dd") & ".xlsm"
    ActiveWorkbook.SaveCopyAs NovoNomeArquivo

    '-- PROTEGER AS PLANILHAS COM SENHA
    'Com exceção da planilha INSTRUÇÃO
    '-- Ignora a pergunta se quer salvar
    Application.DisplayAlerts = True

    '-- BLOQUEIA TODAS AS PLANILHAS
    For Each vPlan In Sheets
        If vPlan.Name <> "INSTRUÇÃO" Then
            vPlan.Protect Password:="123"
        End If
    Next vPlan

    '-- COMPARTILHA A PLANILHA
    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs ActiveWorkbook.Name, accessmode:=xlShared
    Application.DisplayAlerts = True
    MsgBox " Processo Concluído", vbOKOnly + vbExclamation
End Sub

1 answer

0

fernandosavio,

It may be that the bid is not code, but features Excel document... ... please see this:

Share a workbook

1 - Create a new workbook or open a workbook existing that you want to make available for sharing.

2 - On the Revision tab, in the Changes group, click Share Folder work.

3 - In the Share Workbook dialog box, in the tab Editing, check the Allow changes by more than one checkbox user at the same time. It also allows to merge the workbook.

4 - On the Advanced tab, select the options you want to use for track and update changes and click OK.

5 - In the save as dialog box, enter a network location in the Toolbar address.

6 - Follow one of these procedures:

6.1 - If this is a new workbook, enter a name in the File Name dialog box and click Save.

6.2 - If it is an existing workbook, click Save.

7 - Send an email to the people who will share the work. In the message, include the location of the archive and ask them to create a copy of the workbook for own use, keeping all the copies in the folder with the original.

See also on:

Use a shared workbook to collaborate on Excel 2016 for Windows

[]'s, Fabio I.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.