I'm trying to use Excel to create AutoCAD drawings. I have a list of product numbers and I'd like to use VBA so that upon hitting a button it will find a block or a drawing file of every product on the list and paste them into an AutoCAD drawing (to a specific point would be a bonus).
So far I've found code that will read from two columns in Excel and will plot a polyline in ACAD using those columns as coordinates. It's very simple but not exactly what I want. Does anyone have suggestions or example code that does something similar? I've found some online using the "ThisDrawing." object but Excel isn't recognizing that so I've reached a stand still. I have all day tomorrow to work on it, so I'll be doing a lot more searching, but any help is definitely appreciated. Thank you
Autodesk provide free downloads on their website so that you can add the VBA IDE into AutoCAD.
Then, inside the AutoCAD IDE you start a new VBA project.
Add a reference to your Excel library so that you can read the Excel spreadsheet.
You need to look up on:
ThisDrawing.ModelSpace.InsertBlock
In the AutoCAD VBA manual. It tells you what various parameters. But they are straightforward - origin, scale, rotation, path to block.
When you call the InsertBlock routine it will create a AcadBlockReference object. You can do any further customization on that object.
Related
So what my client wants to accomplish seems pretty simple. We will have PPTX file template with a few Excel sheets embedded in it, and a few charts too.
We have created such template file. We are able to extract it, update excel files that sit in ppt/embedded directory with new ones, and pack it back.
The problem is, the display values of the tables or charts do not update automatically when such file is opened. You have to double click on a spreadsheet table or chart to trigger "edit mode". When you leave it the charts are updated.
We figured that internally, PowerPoint is doing screenshots of tables or charts, and uses it to display presentation. This is probably to allow presentation players that do not come with Excel to correctly render the presentation with embedded sheets.
Is there a way I can programatically update the screenshots of tables/charts? Is there some sort of API from Microsoft that would allow me to do that, like "MS Office API".
Maybe there is some way to have MS office configured/scripted, so I send it a file, it runs a VB script on it and returns updated value? I figured I can actually trigger update to screenshots with VB script. But I don't know if I can orchestrate Office program to do what I want.
Help? :)
Sorry I can't embed images, I have the links instead (... I can only post two links. I have removed the http:// substring from some of the links).
I am looking to take an .csv file (really, any file, as I am generating this myself), and create a Visio (2010) diagram out of it. I have successfully imported the excel sheet to Visio, and can create some rough diagrams, but they are not enough. This is what I'm trying to create. Here are the following tactics I have tried, I prefer the VB method, but whatever works works:
Data Graphics: This is the closest I've gotten to a solution. Basically you create shapes and you can put data in it. Problem is, the style of display available are limited, as we can see here (imgur.com/clTLcxk). After importing the excel sheet, all I had to do was drag and drop to create these shapes. The closest I have gotten is here. However, I really need the outside box (or container, for aesthetic reasons). (Some information here [support.office.com/en-us/article/Enhance-your-data-with-data-graphics-45af64a4-1dcb-4463-9a7e-67709786181c])
VB: I have been using this (msdn.microsoft.com/en-us/library/office/ff959245%28v=office.14%29.aspx). I have ran some of the example code, but I am really lost. I have run some of the example code but the only one I have really gotten to work are useless to me. Also, I don't see any API methods that actually add data to these diagrams!
So how is this done?
I would approach this problem by first defining or finding Visio masters that would the data I'm drawing to the page. In your case it looks like you'd want a master for your Foo items, and one for your Bar items.
So then you'd step through your Bars, then within each Bar you'd have one or more Foos. For each Foo, you would drop that master out, and set the text of the shape to what you want in the blue Foo section (maybe a grouped sub-shape for the Foo master), and then text in the white body.
When stepping through all the Bars, you'd obviously have to drop out a Bar shape and position/size it to contain all the Foos.
I am working on developing weather graphics in PowerPoint 2010 for our online weather forecast operation. I am trying to update formatted text (Word Art type formatting, such as text outlining, shadowing, etc.,) automatically within a PowerPoint slide.
Click for example map
I have looked through the numerous articles both here and elsewhere on how to dynamically update text from Excel cells in PowerPoint and other methods, but I can't find any way of updating text such as the temperature values in the map above, while still keeping the visual formatting (which is absolutely crucial for this project). Is there any way to do this in text format, or would I just be better off developing the system so that the text values on the map are actually auto-updating images, so that the formatting is preserved? If that is the route I must take, I am fine with that. I just need pointed in the right direction. Any help would be tremendously appreciated.
Thank you for your time...
I'm loving the added Wireframe template and corresponding shapes in Visio 2010. One thing I can't seem to find though (not in Visio, Office help or using Google) is a good way to draw tabular controls.
The only built-in shape that comes close is a List Box of which I can link several together. However this has several disadvantages as this leaves me without "rows" in my table.
Does anyone have a good suggestion on how to do this? I'd prefer a shape that is aware of the Visio2010 'theme' stuff, but at this point any quick way to draw a grid in a wireframe would be much appreciated.
PS. Searching for shapes on "table" gives me lovely picnic-table-shapes but no usable grids. Searching for "grid" gives me one or two shapes which aren't particularly helpful either.
I find Excel a good way to manage grids in Visio. You can easily add and remove columns, manage formating etc.
In Visio 2010 go to Insert -> Object -> Microsoft Excel Worksheet.
Is was looking for the same and found a way:
http://office.microsoft.com/en-us/visio-help/using-shapes-to-create-tables-in-visio-HA001182242.aspx
So you have to search in the stencils "Charting shapes" to find the grid.
Still not that intuitive to work with, but will do.
Insert->Shapes->More Shapes->Charting Shapes->Grid
If we are looking for Visio Stencils for Grid/Table, a great resource can be downloaded here:
http://developer.yahoo.com/ypatterns/about/stencils/
Too bad no one had a solution. I'll mark this response as an answer to my own question then.
The answer to my problem (for so far I could find) in fact then seems to be that you have to work around this omission in Visio by either:
using linked "List box" shapes
use one of the (rather crappy) table shapes you can search for and find online
use a screenshot (or something alike) from another program
If anyone ever lands at this question with a better workaround or even a real solution please be sure to add it.
I use Visio to design wireframes. When I need datagrids or tabular data, I end up using Excel to design a grid with some data and formatting (fonts, size, border, etc.) Then I select the grid in Excel, copy it to clipboard and then Paste Special in Visio and select Image. Not perfect but works for me.
Create the desired table in Excel. Simply copy and paste special as Microsoft Excel Worksheet, and you can then click into it and do whatever you want.
Tip: Color your grid before copying it so that you don't see the Visio gridlines. Looks much nicer on-screen!
I think the title is fully descriptive now. Anyway, I need to generate a word document from my delphi application. It needs to choose from one of four different equations (with some specific parameters for each document). So far I have manage to create the whole document programmatically except the equation.
Is it possible to create equations programmatically? if so, where is de API documentation from MS? if not, which solution can be used?
Going the VBA route that Brian suggested will only give you the code to open Equation Editor; it won't give you the code for actually creating the equation.
Perhaps the MathType SDK will be of use to you. It's a free download.
Record a macro in a blank document of yourself adding an equation and then save the macro. Opening the macro up in the VBA editor will give you the exact VBA code required to programatically add an equation. If you're using Word's COM API, most of the methods in VBA should have COM counterparts. This technique can be used to discover how to programmatically do anything in Word that you can do in the GUI.