Problem:
I have a user who would like to generate an HTML page directly from Excel (without doing file-save as) but instead click a button and have the current worksheet (or a modified variant thereof) contents just 'pop-up' inside a script-generated HTML page. The rationale is that the Excel content could be used to navigate to different web pages automatically, based on the values entered in the cells by the user.
Question:
1) Has anyone done this kind of thing using Excel, and are there any security implications, above and beyond just the ordinary considerations that go with having macros enabled in Excel.
2) Has anyone done this using an alternate methodology?
Why not write a VBA macro that does the "Save As" operation to save the file in HTML format?
You don't even have to record the macro, you could probably record it using the macro recorder.
Start macro recorder
Save As - HTML format
Stop macro recorder
Assign macro to a button
Related
I have software that generates a 2x 25,000 table of numbers in an .html format. My current process is opening the .html, saving as Excel workbook, etc.
The goal is to automate the process, import the data to Excel, and generate graphs and box charts. I have used macros to accomplish the latter but I am struggling with getting the .html data into the existing .xlsm.
I have found this code, from a helpful thread on Stack Overflow:
Sub Open_HTML_Save_XLSX()
Workbooks.Open Filename:="C:\Temp\Example.html"
ActiveWorkbook.SaveAs "C:\Temp\Example.xlsx", xlOpenXMLWorkbook
End Sub
However, I'm not sure how to use it. I've been using custom made keyboard shortcuts to access my macros such as Ctrl+Shift+Q. I also don't know how to edit it to suit .xlsm.
I wan't to merge multiple access reports to one pdf file using vba code. This vba code needs to work on the computers at my work. These computers only contain Adobe Reader, and I am not able to install Acrobat because I am not Administrator. So now my code generates for all the reports a seperate pdf. I had some code to merge these pdf files to one pdf file where I use 'Acrobat.CAcroApp'. But i get an error on line:
Set AcroApp = CreateObject("AcroExch.App")
I think I am not able to do this cause the computers only have Adobe Reader installed. Is there a possibility to create one pdf file for multiple reports/pdfs without using Acrobat.
Thx in advance
2 solutions.
Make a master report that has each individual report embedded as a sub report. If it's just a few, it should work fine, but too many may bog down / crash the application.
Here's a VBA way of doing it here.
Without acrobat reader this is indeed not going to work. I, however, am using the following dirty workaround for users without acrobat;
Export all your reports to rich text ("*.RTF" format) in the same folder. Afterwards, you open a word application via access vba, and loop through the RTF files and then copy them into your word file, with a page break after every insert. Then, you save the word document as a .PDF file.
This is a method prone to errors, so if a more experienced user has a better way, please do tell. I'm interested as well!
I am writing a Perl script that is parsing a file into an HTML table which essentially contains classes and their information. The main objective of the script is for the user to check which classes he needs and the script will read which checkbox states are TRUE and only include those when creating a file that is like the original. Currently, I'm at the point where the HTML file opens in the users default browser, but if I check some of the checkboxes and save the webpage it doesn't save their states (tried it in Chrome and IE). Is there anyway to do this so that when the file is saved the user can hit enter in the program and have it do its conversion?
I have to convert an Access VBA app over to VB.NET and one of the text boxes (format set to RichText) on the VBA app accepts a straight paste from a Word document including its formatting and saves it to the Access database as HTML... The HTML is then read from the database and displayed as it was originally pasted when retrieved. The issue I have now is, I can use a web browser control to display the data properly from the database, but the RichTextBox gives an Invalid File Format error. When I wish to edit the data I switch the web browser control to the back and copy the data and paste it into the RichTextBox control and then bring the RichTextBox control to the front. This works fine, but once an update is attempted, the data gets saved in RTF format which is not HTML and then when I try to bring it up again from the database, the browser doesn't interpret it as it is not HTML. How can I save it from the RichTextBox, to HTML into the database like the VBA app can?
I've used this in C#:
Create a WebBrowser. Copy and paste the contents from your richtextbox to the webbrowser. And then read the html content (DocumentText) property from the webbrowser.
Edit:
Another way:
Use Office Interop, create a Word file, copy and paste into this file and then save as html.
So I have an excel workbook that has a nice global map of shaperange objects. With some very simple code I can change the colors, group and ungroup collections of countries into arrays, etc...and it works pretty well. However, I would like to bring this into Access.
So I could copy and paste all the shapes into an access form manually, but then they become pictures and I cannot change the colors of the countries (shaperange objects) to have the map act interactively as I can in excel.
So I am thinking that I know how to use excel functions from access, and how to open excel from access. Is there a way to copy an object from excel (I know the file name and the shape name that i mean to copy everytime), and bringing it back to access to paste on a form?
Atypical, I know, all my Access questions are. Thanks!
EDIT:
I would be happy to elaborate my half crazy idea. So I know how to open a new excel instance, or open a template behind the scene (w/o actually making it visible). And I know how to use vba to preform excel tasks, from access modules.....or even run formulas and excel functions from access. i have this interactive map program that works with excel modules, but I would like to make them a part of an access form.
So to answer the below question, if I can just find the missing link with copying and image/shaperange object from excel, and copying it into access form, then I can write code that will always grab the shapes from my excel template format the shapes in excel before copying and pasting into access form, where layout formatting can take place. when a user selects something on a form were I want to include an area of a global map with relative colors/shading, etc...access will always get the pre-defined map pieces it needs from a collection of object in a file/excel template. My idea was after the selection, I would format the shapes, just like I already do with vba, then ole.copy and ole.paste back into the access form. If it is a picture at that point, it doesn't matter. Atleast for the shape itself
lots of code but i think it is worth a try to try to incorporate excel and this shaperange object based map into a form enviroment like the access forms! Pretty strange but it might work well?? Some weird atypical things have become staples in my access database.
Well you're asking this:
"So I could copy and paste all the shapes into an access form manually, but then they become pictures and I cannot change the colors of the countries (shaperange objects) to have the map act interactively as I can in excel.
"So I am thinking that I know how to use excel functions from access, and how to open excel from access. Is there a way to copy an object from excel (I know the file name and the shape name that i mean to copy everytime), and bringing it back to access to paste on a form?"
Maybe some potential responders are asking themselves why if the present solution is not good enough to paste into an Access form because "then they become pictures," but it's okay to Automate the same procedure that you believe is substandard.
Maybe rephrasing the question would help.