Jump to content

Recommended Posts

Posted

Hi all,

 

I'm writing a little VBA Macro to open .dxf files, carry out some changes, and close them. I'd like to be able to import an excel file containing a list of files to work on, but so far it looks like the most challenging bit is to get a dialog to display so the user can select the file. I've tried a few solutions from the MS Office VBA, but they all rely on methods/objects that aren't available to AutoCAD VBA. Has anyone played with this before and found a solution???

 

Any help would be greatly appreciated.

 

Regards

Posted

I use the "Excel.Application" via Visual LISP frequently:

 

(vlax-get-or-create-object "Excel.Application")

 

... What "methods/objects" specifically aren't available to you?

 

Did you reference/import the Excel Type Library (depending on what version it would be Excel.exe), and create an "Excel.Application" object?

Posted

Thanks for the reply... I thought I had updated this thread not long after I posted the original question, but it looks like I forgot to press "Post Reply"...

 

I found the solution I was looking for on this thread:

 

http://forums.autodesk.com/t5/Visual-Basic-Customization/VBA-Open-File-with-Dialog-Box/td-p/1726554

 

I'm using vba Excel.Application to handle the file once it's open, but I couldn't use the Excel.Workbooks.Open method to open the file I wanted to manipulate because the open file dialogue then belonged to Excel meaning that the excel window had to be visible and active in order for the user to select the file. The post above allowed me to keep excel visible, and browse and open the file from a familiar looking dialogue box.

 

It's all under control now 8)

 

Cheers

Posted

It's all under control now 8)

 

Cheers

 

Cool beans, Cheers! :beer:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...