How can you insert VBA or any code into a csv? - vba

I was able to make macros in excel and then run them when opening them. But when I save the file it doesnt save my macros.
How can I make a csv execute code?

Comma Separated Values (CSV) is more or less a standard file format and is only plain text. See https://www.rfc-editor.org/rfc/rfc4180 for more information.
The reason people made different, more complicated file formats is because they wanted to store things (like code or formatting) that plain text doesn't support.
If you want to store code, you have to use a different file format.

When you save the file as .csv, export your VBA into a set of .bas files.
When you open the .csv file, you can also import the saved .bas files into VBA as well.

Related

Vba do not open wbook

There isn't enough memory to complete this action" in Excel
How to fix it without opening file
İ want to turn calculation manual but without open it is impossible
In order to change the automatic calculation to manual without opening the .xlsx file, you can do this. Before doing this, be sure to make a copy of the file and try these manipulations on the copy.
Unzip the .xlsx as a .zip archive, open the file ...\xl\workbook.xml in a text editor, find a tag similar to the following <calcPr calcId="191029"/> and add to it calcMode="manual" so you get <calcPr calcId="191029" calcMode="manual"/>. Then save this file, package the entire directory, and change the extension to .xlsx.

Multiple PDF + Excel list

i am trying to do something a bit difficult (for me) here. So i have a PDF with over a 100 pages and an excel sheet with all the corresponding names of each page.
So what i want is a way to split the PDF into individual PDFs and rename them according to the excel sheet.
Thanks in advance.
Do you have Acrobat?
There is a function to split PDFs by pages, book marks etc in there. I am sure other PDF editing software has a similar feature.
You can then write a VBA script or similar to read the Excel and rename the files, if you are comfortable with code: How to rename multiple pdf files used excel database vba
Or you could try a file name changing software, something like http://www.bulkrenameutility.co.uk/Main_Intro.php

Open a .pdf file

I am trying to open a .pdf file within Excel like an iframe in HTML.
My requirement is:
Save the path of multiple PDF files in Excel.
Excel should open each .pdf file within Excel itself (no need to open that in a separate .pdf window).
It should be like iframe in HTML. The user should be able
to view the .pdf within Excel itself.
I know this is little weird, but can anybody help me?
you could probably get the filenames via vba.
here's some that claim to work:
Loop through files in a folder using VBA?
So far as opening a pdf in excel - thats kinda pushing it.
Since your request is exotic I can think of an exotic workaround:
If you can spare the interactivity you can simply make copies and convert your pdfs to word formats to work with them and load them in that way. I've seen people convert pdfs to Jpgs just to load them in some other documents but thats rudimentary and really fringe.
Otherwise you are facing a lot of custom coding that needs to make it possible.

Excel 2010. Automatically run macro from file with xlsx extension

I work with system, which automatically reads excel file, insets some date and sends to e-mail.
It works only with xlsx extension.
I need, that sending file have some format (borders and filling), so I would like to use macro.
How can I do, that macros automatically run from file with xlsx extension? Can I store macro in Person.xlsm file and run it when it is necessary?
Yes, macros cannot be saved in a .xlsx file. You can however use Workbooks.Open("filepath.xlsx") to open and edit another workbook from a .xlsm workbook. That is the way you should approach it.

Converting Office files to PDF using SaveAs

I have a question about saving the Microsoft Office format file like doc, xls to PDF. I am using the SavesAs option in VB.Net to convert the files to PDF programatically. However, I need to open the file differently to achieve this.
If file is an Excel, then I need to open it using excel API's and then perform SaveAs. Similarly with Word documents. Is there a way so that I can open this documents generically and then use SaveAs option to convert them to PDF irrespective of opening the files?
The Word API and Excel API are two distinct APIs, even though they may both have a SaveAs method. You will not be able to use the same call for both file types.