Opening csv from in Sharepoint and saving to Excel on Desktop

%3CLINGO-SUB%20id%3D%22lingo-sub-2409934%22%20slang%3D%22en-US%22%3EOpening%20csv%20from%20in%20Sharepoint%20and%20saving%20to%20Excel%20on%20Desktop%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2409934%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EHello%2C%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EI%20have%20a%20macro%20that%20copies%20a%20CSV%20file%20from%20a%20sharepoint%20folder%20and%20pastes%20it%20to%20a%20workbook%20on%20my%20desktop.%20The%20issue%20is%20when%20I%20step%20in%20to%20the%20sub%2C%20it%20shows%20as%20if%20it%20opens%20the%20file%20but%20it%20looks%20like%20an%20old%20file%20on%20my%20downloads%20folder%20that%20I%20downloaded%20the%20first%20time%2C%20not%20the%20file%20saved%20in%20sharepoint.%20It%20is%20like%20if%20it%20opened%20a%20temporary%20file%20downloaded%20previously%20as%20it%20says%20last%20modified%20May%2011%20but%20it%20was%20created%20just%20now%20(06%2F02)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EHere%20is%20my%20path%3A%20(%22%3CA%20href%3D%22https%3A%2F%2FXXXX.sharepoint.com%2Fsites%2FReports%2FShared%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2FXXXX.sharepoint.com%2Fsites%2FReports%2FShared%3C%2FA%3E%20Documents%2FProduction%20Reports%2FData%2FConversion.csv%22)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EAlso%20tried%20path%3A%20(%22%3CA%20href%3D%22https%3A%2F%2FXXXX.sharepoint.com%2Fsites%2FReports%2FShared%2520Documents%2FProduction%2520Reports%2FData%2FConversion.CSV%3Fweb%3D1%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2FXXXX.sharepoint.com%2Fsites%2FReports%2FShared%2520Documents%2FProduction%2520Reports%2FData%2FConversion.CSV%3Fweb%3D1%3C%2FA%3E%22)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3Eand%20path%3A%20(%22%5C%5CXXXX.sharepoint.com%5Csites%5CReports%5CShared%20Documents%5CProduction%20Reports%5CData%5CConversion.CSV%22)%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EThe%20last%202%20options%20say%20the%20file%20could%20not%20be%20located.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EHere%20is%20the%20whole%20code%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-visual%22%3E%3CCODE%3EDim%20conversionWB%20As%20Workbook%2C%20ThisWB%20As%20Workbook%0A%20%20%20%20Application.ScreenUpdating%20%3D%20False%0A%20%20%20%20Set%20ThisWB%20%3D%20ActiveWorkbook%0A%0A%20%20%20%20Set%20conversionWB%20%3D%20Workbooks.Open(%22https%3A%2F%2FXXXX.sharepoint.com%2Fsites%2FReports%2FShared%20Documents%2FProduction%20Reports%2FData%2FConversion.csv%22)%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20ActiveSheet.Copy%20after%3A%3DThisWB.Sheets(ThisWB.Sheets.Count)%0A%20%20%20%20conversionWB.Close%20False%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2409934%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Visitor

Hello,

I have a macro that copies a CSV file from a sharepoint folder and pastes it to a workbook on my desktop. The issue is when I step in to the sub, it shows as if it opens the file but it looks like an old file on my downloads folder that I downloaded the first time, not the file saved in sharepoint. It is like if it opened a temporary file downloaded previously as it says last modified May 11 but it was created just now (06/02)

Here is my path: ("https://XXXX.sharepoint.com/sites/Reports/Shared Documents/Production Reports/Data/Conversion.csv")

Also tried path: ("https://XXXX.sharepoint.com/sites/Reports/Shared%20Documents/Production%20Reports/Data/Conversion.CS...")

and path: ("\\XXXX.sharepoint.com\sites\Reports\Shared Documents\Production Reports\Data\Conversion.CSV")

The last 2 options say the file could not be located.

Here is the whole code:

 

 

 

Dim conversionWB As Workbook, ThisWB As Workbook
    Application.ScreenUpdating = False
    Set ThisWB = ActiveWorkbook

    Set conversionWB = Workbooks.Open("https://XXXX.sharepoint.com/sites/Reports/Shared Documents/Production Reports/Data/Conversion.csv")
        
    ActiveSheet.Copy after:=ThisWB.Sheets(ThisWB.Sheets.Count)
    conversionWB.Close False

 

 

 

0 Replies