+ Reply to Thread
Results 1 to 1 of 1

Save Individual Tabs into new Subfolder on Sharepoint folder

  1. #1
    Registered User
    Join Date
    01-11-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Save Individual Tabs into new Subfolder on Sharepoint folder

    I have an old macro that I used to use to separate a dataset onto specific tabs, and then save those individual tabs as their own file. These files were saved in a date/timestamped subfolder where ever the main file existed.

    My issue is that I have now saved a version of this macro onto a SharePoint folder, and when I run it I get an error "Path not Found" and when i Debug, the line 'MkDir FolderName" is highlighted.
    Can anyone explain what needs to be changed in order for this to work in a SharePoint folder?
    Note: This file will be used by many individuals, so their specific SharePoint drive will have different 'paths'.

    Here is the portion of the macro that I believe is the issue...

    Any help is VERY apprecaited.
    Sorry if I didn't post this correctly.


    Set Sourcewb = ThisWorkbook
    DateString = Format(Now, "yyyy-mm-dd hh-mm")
    FolderName = Sourcewb.Path & "" & Sourcewb.Name & " " & DateString
    MkDir FolderName
    For Each sh In Sourcewb.Worksheets
    If sh.Visible = -1 Then
    sh.Copy
    Set Destwb = ActiveWorkbook
    With Destwb
    If Val(Application.Version) < 12 Then
    FileExtStr = ".xls": FileFormatNum = -4143
    Else
    If Sourcewb.Name = .Name Then
    MsgBox "Your answer is NO in the security dialog"
    GoTo GoToNextSheet
    Else
    Select Case Sourcewb.FileFormat
    Case 51: FileExtStr = ".xlsx": FileFormatNum = 51
    Case 52:
    If .HasVBProject Then
    FileExtStr = ".xlsm": FileFormatNum = 52
    Else
    FileExtStr = ".xlsx": FileFormatNum = 51
    End If
    Case 56: FileExtStr = ".xls": FileFormatNum = 56
    Case Else: FileExtStr = ".xlsb": FileFormatNum = 50
    End Select
    End If
    End If
    End With
    If Destwb.Sheets(1).ProtectContents = False Then
    With Destwb.Sheets(1).UsedRange
    .Cells.Copy
    .Cells.PasteSpecial xlPasteValues
    .Cells(1).Select
    End With
    Application.CutCopyMode = False
    End If
    With Destwb
    .SaveAs FolderName _
    & "" & Destwb.Sheets(1).Name & FileExtStr, _
    FileFormat:=FileFormatNum
    .Close False
    End With
    Last edited by Chuckf1; 09-22-2022 at 11:32 AM. Reason: Multi-Users Clarification

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] split and save individual tabs
    By trisoldee in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-20-2022, 02:45 PM
  2. [SOLVED] VBA to create folder, subfolder and save workbook
    By aaaaa34 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-06-2019, 12:30 PM
  3. Replies: 14
    Last Post: 09-18-2016, 08:13 AM
  4. Save as pdf in current folder in Sharepoint
    By Jacc in forum Word Programming / VBA / Macros
    Replies: 5
    Last Post: 12-22-2015, 08:25 PM
  5. Create new folder and subfolder and save file with the names from cell values
    By eccordeiro in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-16-2015, 10:03 AM
  6. VBA to save tabs as individual workbooks by tab's name
    By mfirpo in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-02-2014, 04:34 PM
  7. VBA to save file to sharepoint folder
    By rlsublime in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-20-2014, 04:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1