Need help with this small macro

bjornltd

New Member
Joined
Mar 8, 2013
Messages
14
Hi,

I have the following code for saving a new sheet, but this only works when the original file is .xlsm. Any way to change this to work when the original file is .xltm?
When the original file is .xlsm it saves in the right shared Onedrive folder, but when the original file is .xltm the now file saves locally on the computer.

Code:
Sub SvMe()
    Dim newFile As String, fName As String
    fName = Range("B34").Value
    newFile = fName & " " & Format$(Date, "dd-mm-yyyy")
    With ActiveWorkbook
        .SaveAs Filename:=ThisWorkbook.Path & "\" & newFile & ".xlsm", FileFormat:=52
    End With
     
End Sub

Please help :-)
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Code:
.SaveAs Filename:=[COLOR=#b22222]ThisWorkbook.Path [/COLOR]& "\" & newFile & ".xlsm", FileFormat:=52

You would need to change the path to the shared Onedrive folder in the above statement.
 
Upvote 0
The problem is that we are several users with different paths to the shared folder.... Would that be the only way to get it to work?
 
Upvote 0
I don't understand how you can have different users accessing the same shared folder with different paths to the folder. It should be the same path for each user to access a server and its directories. But I could be wrong.
 
Upvote 0

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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