VBA Excel : Automatically change the file path [closed] - excel

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
My file has been saved at a particular path with a name Ankit1.xls. It has macro coding and is working fine. But my question is that whenever I change the file name the macro doesn't work. I need to change the path in coding wherever needed. Please can someone help me in coding in such a way that whenever I change the file name the macro will automatically change the path and does not give me the error.
Thanks
Ankit

I guess you are looking for
ThisWorkbook.Name
or
ThisWorkbook.Path

Use Thisworkbook object in order to access data from Ankit1.xls file without changing the hardcoded constant that represents the workbook name.
Additionally you can code prior to this to check that the correct workbook has been opened.

Related

python open() vs pd.read_csv() [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 months ago.
Improve this question
a photo of using open() and pd.read_csv() to open a link but open() says no file directory, why do I have an error when I used open() but pd.read_csv opened the file, I tried using it again but it says file not found?
The function open() opens a file which resides in persistent memory (SSD/HDD), and returns a file object.
pandas.read_csv() can parse input directly from URLs.
In other words: Because the file, as the error says, does not exist and neither does a path to said file.
Edit: I just realized that you may be new here, so maybe I'll give an analogy: Imagine I told you to open a book, and said out loud a link to a book. You would wonder how you would ever open that book as well, because you have no way of parsing that information in your head. If I instead send you link, which you open on your computer, you can read the file. open() wants a physical book. pd.read_csv() can also accept a link to the book.

Saving File without an extension [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
We have a system that creates files that are imported into Oracle. The files have the naming convention...
Filename.0000
Where the numbers are incremented with each export. So one file might be filename.4357 and the next file will be filename.4358.
I have managed to import the file into a spreadsheet as a comma delimited file where I then carry out some cleansing of the file.
I then want to save the file back to this unusual type .0000 but I can only seem to save it as Excel, CSV, TXT, PDF etc.
Does anyone have any ideas ? Thank you in advance.
Nothing yet
Save the file as a txt file and close it. Then rename it in Windows Explorer.
You can also do that with VBA. Use the NAME command to rename it to a file name with the desired extension.
https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/name-statement

Whaetever file I try to open with excel it launches the same macro on a previous file that I did, IM LOST [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
How can I invert this problem, I didn't touch the code but I don't know maybe while saving the file. I can't open any files anymore because it keeps opening the same macro.
Thank you for your help
The macro is likely stored in your personal workbook. Personal workbooks open every time you open excel which would explain why it looks like this macro is "haunting you from the dead".
You can read about personal workbooks here.
https://support.office.com/en-us/article/copy-your-macros-to-a-personal-macro-workbook-aa439b90-f836-4381-97f0-6e4c3f5ee566

Use custom formats in new Excel files [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a set of custom formats that I would like to use in any new Excel files that I create.
I found this approach, Save cell styles to use in all new workbooks, but it relies on using a template which I cant use as I am using a cloud server so I don't have access to the XLSTART folder.
Using code is fine if I must, but I don't have experience in this space.
I understand that I may be able to create an Excel addin to hold the formats, and create a new workbook from that. Is this addin the way to go?
Please help!
Is this a desktop Excel program? If so, you might try adding another custom startup folder. (Depending on version it might be different, in 2013: Excel Options - Advanced - General - At startup, open all files in:.) Now if you put a file here, it will auto-open on Excel startup, just like the files in the XLSTART folder.
(But to be honest, I don't see how this will help you, since XLSTART - or any automatic startup folder - is useful if you want macros available. I'm not sure about templates.)

How to download all subtitles from Opensubtitles.org in a specific language? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
Excuse me if this post is not related to this forum, but I couldn't find any other place to ask my question. It would be appreciated if you introduce me a suitable place for this post.
By the way, I am trying to download all the subtitles from Opensubtitles.org in a specific language (say English) and find their translations in another language (say Arabic). I tried wget, but I couldn't download anything useful from this site. (I need .srt, .zip and .txt files)
Can everyone help me?
Bests.
Downloading everything individually will put an unnessesary load on their servers. Better use something like http://opus.lingfil.uu.se/OpenSubtitles.php
The download link is something like:
http://dl.opensubtitles.org/en/download/sub/4617044
Where 4617044 is the ID of the subtitle. You can use this URL with wget to download it, but it won't have the correct filename.
Alternatively, you can use the XML-RPC api to search and download subtitles.

Resources