does nothing

PIsabel

Board Regular
Joined
Feb 4, 2014
Messages
121
Office Version
  1. 365
Platform
  1. Windows
Hello
Is there something missing here?
As it is this code does nothing.

I need the code, with the file open, to change the folder and rename it


Code:
Sub Savefile()
    If ThisWorkbook.Path = "[URL="file://\\Servidor\servidor\ORÇAMENTOS\orç"]\\Servidor\servidor\ORÇAMENTOS\orç[/URL] - A Fazer" Then
    With ThisWorkbook
        strWbKill = .FullName
        .SaveAs "[URL="file://\\Servidor\servidor\ORÇAMENTOS\orç"]\\Servidor\servidor\ORÇAMENTOS\orç[/URL] - A Fazer" & "- Orçamento - profissional - " & Range("e3") & (" - ") & Range("I3") & (" - nº ") & Range("J2") & " - " & Range("E8")
    End With
    Kill strWbKill
    Else
    
    If ThisWorkbook.Path = "[URL="file://\\Servidor\servidor\ORÇAMENTOS\orç"]\\Servidor\servidor\ORÇAMENTOS\orç[/URL] - Vendido" Then
    With ThisWorkbook
        strWbKill = .FullName
        .SaveAs "[URL="file://\\Servidor\servidor\ORÇAMENTOS\orç"]\\Servidor\servidor\ORÇAMENTOS\orç[/URL] - Vendido" & "- Orçamento - profissional - " & Range("e3") & (" - ") & Range("I3") & (" - nº ") & Range("J2") & " - " & Range("E8")
    End With
    Kill strWbKill
    
    End If
End If
End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
It's my fault and my bad English.
The code must rename the file (with it open) regardless of the folder where it is located







Perhaps you don't have permissions to change the folder name of the server?
 
Last edited:
Upvote 0
Yes I understand what it should do (the location is irrelevent). If you have a folder (no matter where it is stored) if you do not have the required ownserhip/permissions to change the folder name then nothing will happen - which is what you're getting.
So it could be you don't have ownership/permissions to change the name of the folder.
 
Last edited:
Upvote 0
But I dont want to change the folder name...only the file name
 
Last edited:
Upvote 0
"I need the code, with the file open, to change the folder and rename it"

Try thinking before typing
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,824
Members
449,190
Latest member
rscraig11

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top