Code Red > VB(A)

Table Importer - Microstation

(1/3) > >>

jvillarreal:
Its a long shot, but has anyone converted the Bentley provided table BASIC file to MVBA?
(Table.bas) or possibly code that maps excel lines/text to coordinates and arrays?

My new employer does not provide Axiom or any other third party software for importing tables from excel.

I have a q&d workaround for creating a csv file using a selected range in excel to work in conjunction with the bas, but was hoping somebody had something better they'd be willing to share.

jvillarreal:
Alright, I see its been requested many times online by Microstation users, so I've written a mvba macro for importing a selected range of cells from Excel into a dgn. Could use some cleanup..but it gets the job done.
It would be much appreciated if someone with more experience could show how to link the excel file to the text elements.

Edit: Forgot to mention, this has been tested on v8i SS4
Edit 2: Code Removed

jvillarreal:
Edit: Code Removed

Small update to include text wrapping [even if Chr(10) was not used in excel]

Example Input and Output shown below:

To Import the file, Press Alt+F11 to open the Visual Basic Editor
Right Click on your Default.mvba and Select Import File

Required References:
Visual Basic Editor (Alt+F11) > Tools > References
These should automatically be selected after importing the macro, but if not, references needed for the macro to function (and for possible future modification) are shown below:

Note:
Text Settings can be found in the AddCell Function.
Settings have been set up to work with a 1:10 scaled drawing.


jvillarreal:
Edit: Code Removed

All objects are now placed in a cell for efficiency and an 'ExcelSheet' link to the ProjectWise worksheet is attached.
I'd prefer to have it automatically update upon opening the drawing, but this will have to do for now.

Additionally, the code has been updated to allow the user to control text settings with the  "Change Text Attributes" dialog box.

Updated Info:
TableImport.Excel2Table.mvba
Excel2Table allows a user to create a table in Microstation based on a  selected range of cells in an excel spreadsheet. Upon running the macro, if the user has not made a range selection, excel is started and the user is prompted to select a range before continuing. Once a selection has been made, the user can optionally modify text attributes for the table or continue with a point selection for table placement.
Each spreadsheet cell is then imitated (separate boxes & text) and the resulting objectsare placed in a Microstation table cell; This includes functionality for rotated Microstation views, merged cells and wrapped text in excel; and settings for vertical margins and text properties (color, justification, width, height and font)

jvillarreal:
Final Update - I was able to link the table to excel by naming the cell with the table range; then creating a sub to open the attached link, select the range according to the cell name, and replace the table cell.
                     Modifying the new cell origin to match the original origin allowed consistent placement for rotated views;

Navigation

[0] Message Index

[#] Next page

Go to full version