Activate csv file with partial name with VBA

Finagill

New Member
Joined
Jan 17, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Every morning I need to open a csv file from a web based server, sort and filter the data, then copy the relevant data over to an Excel sheet. To make things even more interesting, only part of the file name stays the same. I prefer to not have to save the file as I am trying to make sure that the code works for everyone. The file is not located anywhere that I can get to except through a web based interface. I figured out how to do everything if this was a Excel file. The code that I am using is:

For Each wb In Workbooks 'Finds Oracle workbook
If Left(wb.Name, 10) = "Custom_STN" Then Set oBook = wb
Next

This works great for Excel files but it doesn't look at csv files. Is there anyway to automate this without have to save the file?
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
There are ways to open .csv files in NotePad. As for the internet, you need to automate that with IE VBA, or Selenium Basic. I have something I do every morning that extracts a file online and opens it in NotePad and finds and replaces certain text all written in VBA. Let me know if I can help guide you in anyway. You need to elaborate a little more for me to help
 
Upvote 0
I still plan on opening the csv file manually as it just seems to be trouble then it is worth to write a program to do it for me. When I open the file it automatically opens in Excel as a csv file so that is why I was hoping that there was a way in Excel to have it activate an open csv file.
 
Upvote 0
Do you want the .csv file to open in Excel or do you want the .csv file to open in Notepad?
 
Upvote 0
The process that I have to go through in order to get the file opens it automatically in Excel so I do not need to open it again. Until I can obtain access to the actual location where the file is stored I have to open in order to obtain it.
 
Upvote 0

Forum statistics

Threads
1,214,965
Messages
6,122,500
Members
449,090
Latest member
RandomExceller01

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