Hi everyone, some words of wisdom please....
I have a workbook with several sheets and macros. Some of these macros attempt to save/open files to/from a subfolder inside a local ONEDRIVE folder.
I need to be able to set this up on multiple machines (all with different OneDrive accounts)and for them all to work.....
When I test the following on a 'dummy' onedrive folder (that is not actually connected to OneDrive) this path/address it works.
Trying it on a 'real live' onedrive folder gives me an error.
Sub SaveWorkbookAsSchoolAndTeacherCode()
Dim NewName As String
Application.DisplayAlerts = False
FilePath = Environ("USERPROFILE") & "\OneDrive\!Registers"
NewName = "\HMS Register 2015-6 - " & Worksheets("Register").Range("G5").Value & " - " & Worksheets("Register").Range("G2").Value & ".xlsm"
ActiveWorkbook.SaveAs FileName:=FilePath & NewName
ThisWorkbook.Saved = True
Application.Quit
End Sub
I have also tried this with no sucess
Sub SaveWorkbookAsSchoolAndTeacherCode()
Dim NewName As String
Application.DisplayAlerts = False
FilePath = "c:\User\\OneDrive\!Registers"
NewName = "\HMS Register 2015-6 - " & Worksheets("Register").Range("G5").Value & " - " & Worksheets("Register").Range("G2").Value & ".xlsm"
ActiveWorkbook.SaveAs FileName:=FilePath & NewName
ThisWorkbook.Saved = True
Application.Quit
End Sub
and this is broken too .... ;(
Sub SaveWorkbookAsTempRegisterToMergeReportsForm()
Application.DisplayAlerts = False
Dim ExcelSaveAsName As String
ExcelSaveAsName = Environ("USERPROFILE") & "\OneDrive\!Reports\hidden\TempRegisterToMergeReportsForm.xlsm"
ActiveWorkbook.Save
End Sub
Please can anyone help?
Many thanks in advance :
Gideon
Bookmarks