Author Topic: VBA function to open OLE objects  (Read 2556 times)

0 Members and 1 Guest are viewing this topic.

bharless72

  • Mosquito
  • Posts: 3
VBA function to open OLE objects
« on: December 16, 2023, 02:01:31 PM »

Good morning all,

The situation is that my company has recently made the change to using a laser to create some of our components rather than stamping them. The trouble comes with the creation of to scale, perfectly accurate parts, due to human error and time constraints its something that's left best to a program to do rather than a draftsman. I have 90 percent of the program working just fine but I have ran into an issue with the way we do indented bill of materials in our drawings. The program takes input from the user and calculates things such as strip width, weight, etc and pastes those values into a linked excel sheet. When those values paste into the sheet they do not automatically update, but if I open the sheet it will dump all of the values where they should be. I cant seem to figure out a way to either open the sheet with VBA and make it update or find a way to make the sheet update without opening it. The sheet is on a layer called Excel, the handle is 4536, and it is in paper space. I have tried to select the object and sent the openole command via the command line but the program stops and autocad prompts the user to select a second point so that doesn't seem to be the answer. Any help is very much appreciated and I hope everyone has a safe and enjoyable holiday.

57gmc

  • Bull Frog
  • Posts: 362
Re: VBA function to open OLE objects
« Reply #1 on: December 16, 2023, 06:07:42 PM »
There's very little that you can do in vba to work with OLE. I would use an acad table with a datalink to Excel. The datalink will automatically update.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8690
  • AKA Daniel
Re: VBA function to open OLE objects
« Reply #2 on: December 16, 2023, 06:22:26 PM »
According to the docs, there’s a AcadOle object, you might explore what OleSourceApp or update do
https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-F22B8915-FE51-4650-A738-95C81019064E