Help needed : Open csv file in Box using VBA

jimmywong98

New Member
Joined
Nov 27, 2011
Messages
49
Hi Guys
Happy New Year! Does anyone know how to write a VBA script to open a CSV file in Box and copy out the data into excel sheet?
i have no idea how to write such scripting. Help needed.

thanks!
 

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.
Here are the scripts i used.. kindly guide

my idea is, using VBA to open a https link, download the content of the csv file to my macro workbook. From there i will perform my data processing.


Sub Macro1()


Dim Wb As Worksheets
Dim sFound As String
Dim path As String
path = "https://abc.app.box.com/files/0/f/11818289157/Customer%20Macro"
sFound = Dir(ActiveWorkbook.path & "\Book_*.xlsx")
If sFound <> "" Then
Set Wb = Workbooks.Open(Filename:=ActiveWorkbook.path & "" & sFound)
End If


With Wb.Sheets("Sheet1")
.Cells.Copy
End With


Workbooks("Book1.xlsm").Sheets("S").Range("A1").PasteSpecial Paste:=xlPasteValues
' VBA to close the source file
Application.CutCopyMode = False
Application.DisplayAlerts = False
Wb.Close
End Sub

However, error occurs as" Object variable or With block variable not set "

Can anyone help? Am still new in writing VBA scripts.

thanks!
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,841
Members
449,051
Latest member
excelquestion515

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