Call function in browser console after clicked hyperlink in Excel - excel

I have such situation. I have to call function in browser console after user clicked a hyperlink in Excel. One of function's argument is based on row's data, so it's kinda dynamically generated.
Is this possible within Excel environment?
If anything is unclear, let me know.
Thanks guys.
EDIT: I have thought already about using batch file, to convert hole excel file to html or use Python script, but non of this is simple. Problem is that I'm not a VBA guy, so I'm asking SO community to suggest if that kind of thing is even possible in Excel(VBA).

Related

How to call macros using azure api

I have an excel file containing around 100K rows in onedrive. This file contains some macros. I want to run these macros using api.I want to pass these macro functions as parameters.
For example
https://graph.microsoft.com/beta/me/drive/root:/book1.xlsx:/workbook/tables/{id|name}
Here, I want to call macros function in place tables/{id|name}
Any way to do this?
Thanks
To be able to run an Excel macro, you need a running Excel instance that opens the file containing the macro and runs the code. There is no way around this I'm afraid.
So you need a machine - physical or virtual - where Excel is installed. Then you can have a script open the Excel file there and run the macros.
If you are working in a cloud environment or on a web server for example, you would be better off rewriting the code in another language, independent of Excel. (Trust me, I've been there, done that.)

Add text to pdf using Excel -VBA

I don't have much knowledge about VBA.
But I have a problem which I think can be solved with VBA.
I have a PDF file of 400 pages. I have an excel with page numbers and some text. Now I want this text to be copy pasted (Add Text under drawing markup in PDF tools) in the PDF.
I can do it manually but it will take 3 to 4 days. so can anybody help me and make my work easier. I wanted to do this in Excel-VBA.
I have 2013 Excel and Acrobat xi Pro.
It depends.
If the pdf has forms in it, you are of course able to fill them in a programmatic way.
If your document does not contain forms you are not going to be able to solve this problem in a trivial manner.
Why, I hear you ask?
PDF documents, despite their reputation are more like containers of instructions than they are a WYSIWYG format
instructions are bundled in groups called "objects"
objects can be compressed (DEFLATE) into streams
objects are indexed so they can be re-used (this is called the xref)
the index uses byte-offsets to get a grip on which object is where in the document
Now what would happen if you wanted to add a single character somewhere in the document
you would need to decode the streams to figure out where you're actually placing content
Once you've found the right stream, and you've inserted your character, you have also screwed up the xref table.
Nothing will work anymore

Excel open same names files

I need to create a button in Excel that opens a dialog box and I select the file that I recorded on the second sheet, but I also automatically select other files with the same name differs just ending. So I need to choose one file, and always record 2-3 more with the same name and to open a new worksheet. How to do it?
What you need to select the file abc.txt and uploaded to other files abc.ydd and abc.dyk name will always be the same only the ending will be different.
An advice for any work you are doing: Break down your big task into small steps as often as needed until the steps are small enough so that you know how to process them.
On your specific programming task, this means, you should break it down into:
You need a button on one of the excel sheets.
That button has to open a dialog box for selecting a file
I don't know whether it can be any arbitrary file or a specific one, as you wrote that the file was recorded on another sheet. I think that makes no difference at all.
After finishing the file selection, you have to evaluate the result of the dialog box (OK -> which file, ABORT -> do nothing).
Take the file name, remove the extension and search for other files (in the same directory or elsewhere) with that name.
I don't know why you want to open another worksheet. Of course you can do that, but if you want to show the content of that files in the worksheet, they better be excel files.
How you do these suggested steps is something you need to find out by yourself. Or you are lucky and find someone else who has plenty of free time to do that for you, but I don't think you will be that lucky, especially after providing a quite vague description of your problem.
In general, stackoverflow is for asking for solutions to specific programming problems, not for providing ready-to-use solutions for beginners. Take a look at VBA manuals and tutorials. They can be found widely across the internet and in book stores.

Extracting a page from a pdf using a keyword

OK so im quite sure i cant do this with excel vb or for free even.
Im writing these macros for work, and one of them needs to be able to chose a pdf based on keywords.
Then go into the pdf, search either the titles of the pages or the text on the pages themselves using a different set of keywords.
When it finds the page that matches one of the keywords in the second set, it will extract the whole page, as is, to a single page pdf.
This can then be attached to email.
This will be only a small part of the purpose of the macro.
From what i understand, im probably going to have to find an SDK, pay for it, and write a separate program in C# or VisualBasic which is run when the macro needs.
I dont even need the code, maybe just a point in the right direction :D
In the end i got a program called pdftk.exe, free, and runs in command line.
With this i can export the Bookmarks listing to txtfile.
Search text file for string/keywords.
Jump down a line or two and grab associated page number.
Then use the same exe to extract that page and save as specific name, then my vba macro can grab that newly created 1 page pdf.
Ive seen code on this site for creating delays while another process is doing its thing, so i will try to implement that also.

How to script Excel or Numbers on a mac, and launch from bash?

I want to write a bash script for a mac which takes a text file containing a table of numbers (can be .csv), converts the numbers to a chart, saves the chart (any file format that I can display on my web page), and exits. It must do this unattended. No user interaction.
I know bash, perl, and a little AppleScript, and I can learn VBA or whatever else. I am about to plunk down money for the new Excel 2011 for Mac. I think I want Excel rather than Numbers'09, but I am not at all sure, and I think VBA or AppleScript will allow me to automate most of the work.
Is AppleScript + Excel a good choice? If so, then I'm home free. Applescript programs can be launched from bash via osascript command.
But maybe VBA is better? But how can I launch a Excel VBA script from bash on a mac?
Summary of questions: (1) AppleScript or VBA or something else? (2) Excel or Numbers? (3) How to launch Excel VBA script from bash?
Thanks in advance,
Ken
Don't forget to try OpenOffice (and derivatives). It's been a while since I last worked with it, but they have a macro language and some VBA support (don't know how good it is now, I'm sure it's progressed) - so it could likely generate your graphs for you.
Alternatively, this sounds like something Gnuplot could very easily do. See this article where they start with the raw data in a text file, and create a PNG file for use in a web page: http://www.ibm.com/developerworks/aix/library/au-gnuplot/index.html
Just thought you should know about other options than Excel and Numbers...
You should definitively consider using gnuplot (free), which can easily create graphics and even HTML5 canvas elements from different input file formats via the command line.
iWork 09 does support Applescript. Pages is pretty good with its support. Numbers far less so. I think most expect more expansive Applescript support with the new version as Numbers only has partial support. So for what the original question asks you really need to use Excel.
If you are going to script I'd look seriously at Python or Ruby combined with Appscript rather than Applescript or VBA. Applescript is a bear of a language to write in and using one of the other languages gives you all the libraries of that language. That allows quite a bit more powerful code to be written.
If you are just writing for Office and don't need much other functionality then I'd probably stick with VBA.
You might like to take a look at Google Chart Tools.
It is exceptionally useful for including charts and graphs within web pages.
You just create a URL containing the data as a src for an image, then tada, it appears.
Have a play.
For instance, a few parameters:
chd=t:10,20,30
chco=FF0000|00FF00|0000FF
chs=320x240
cht=p3
chdl=Red|Green|Blue
Makes a URL: https://chart.googleapis.com/chart?chd=t:10,20,30&chco=FF0000|00FF00|0000FF&chs=320x240&cht=p3&chdl=Red|Green|Blue
Which forms a chart:
I would recommend using Numbers and AppleScript if you are on OS X—these are well integrated. Also, you could use Automator to make your life even simpler.
Microsoft removed VBA support from Office with v2008. iWork '08 has no Applescript support, and while I can't speak directly about v'09 given Apple's recent decline in scriptable applications I wouldn't count on it.
The sure, long-term bet here would be to use Excel with Applescript.

Resources