Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1079979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:57:28+00:00 2026-05-16T21:57:28+00:00

such a silly question I know, but I want to remove the filename in

  • 0

such a silly question I know, but I want to remove the filename in a string such as

"blah\bleurgh\filename.txt"

To delete the extension I would do

strFile = Left(strFile, InStrRev(strFile, ".") - 1)

But doing similiar to delete the filename at the end does nothing, e.g.

tempStrFile = Left(tempStrFile, InStrRev(tempStrFile, "\") - 1)

A “\\” doesn’t work either, incase it was an escape character issue.

Many thanks!

edit: for further information what I want to do is if given a filename such as “filename.txt” I want to output “output_filename.csv” – I have no problems with this.

If I get a directory though such as “blah\filename.txt” I have difficulty sticking output in the middle to get “blah\output_filename.csv”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T21:57:29+00:00Added an answer on May 16, 2026 at 9:57 pm

    If I understand what you want, then your code works for me, the following code:

    dim tempStrFile
    tempStrFile = "blah\bleurgh\filename.txt"
    tempStrFile = Left(tempStrFile, InStrRev(tempStrFile, "\") - 1)
    tempStrFile = tempStrFile & "\output_filename.csv"
    msgbox tempStrFile
    

    will output blah\bleurgh\output_filename.csv which I belive is what you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First I want to apologize for such a silly question but I'm quite new
I know this is such a silly question but I tried every bracket I
Sorry for such a silly question but Python docs are confusing... Link 1: Queue
Sorry for such a trivial question, but I'd feel silly building this if it
This may be a silly question to some, but I was curious how would
I know this might be a bit of a 'silly' question, but sometimes, I
I apologize in advance for asking such a silly question, but I can't seem
I am not sure if this question is not silly, but I really want
I know it looks like a silly question , but how am I supposed
Probably a really silly question, but I can't fathom it: I want to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.