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 3595208
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:49:19+00:00 2026-05-18T19:49:19+00:00

Have a program that’s dynamically generating an Excel file and a csv. The excel

  • 0

Have a program that’s dynamically generating an Excel file and a csv. The excel file has VBA code that loads the csv data “on load” and I want to dynamically call that csv by having the csv file have the same filename, but just the different extension. So, based on my understanding this if the xls file was here:

C:\directory\filename.xls

This VBA code:

Function GetFullName() As String

 GetFullName = ThisWorkbook.FullName 

End Function

Would result in

GetFullName() = "C:\directory\filename.xls"

So, if that’s correct (source of code), how do I replace “.xls” with “.csv” and then insert that value into a file call. Or for example, to keep it simple, the file has VBA that prints a PDF using this code; which would require me to use the GetFullName, and change “.xls” to “.pdf”:

Sub PrintPDF()

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "C:\directory\filename.pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False _

End Sub

Hope the problem is clear, if there’s a better solution concept, I’m open to it. If you’ve got questions, just let me know.

  • 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-18T19:49:20+00:00Added an answer on May 18, 2026 at 7:49 pm

    Replace could be exactly what you want:

    Function GetFullNameCSV() As String
    
     GetFullNameCSV = Replace(ThisWorkbook.FullName, ".xls",".csv")  
    
    End Function
    

    You can extend this by including the extension you want like so:

    sFileName = GetNewExt("pdf")
    
    Function GetNewExt(Ext As String) As String
    
     GetNewExt = Replace(ThisWorkbook.FullName, ".xls","." & Ext)  
    
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program that displays info based on the day. Everything has been
I have a program that grabs some data through ssh using paramiko: ssh =
I have a program that accepts a Cmd command as a command argument. Basically
I have a program that reads a raw list of in-game entities, and I
I have a program that returns something like this: status: playing artURL: http://beta.grooveshark.com/static/amazonart/m3510922.jpg estimateDuration:
I have a program that takes an image and writes that out to a
I have a program that makes calls to an internal web API. However when
I have a program that returns int*int (Example for illustration purposes): fun program(a,b) =
I have a program that uses curses, and then returns to the main script
Problem with % n * %n in writable segment detected * C++ i Qt

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.