Jump to content



Featured Articles

Check out the latest featured articles.

File Library

Check out the latest downloads available in the File Library.

New Article

Product Viscosity vs. Shear

Featured File

Vertical Tank Selection

New Blog Entry

Low Flow in Pipes- posted in Ankur's blog

Hide Stream Table In Excel

simulation aspen

This topic has been archived. This means that you cannot reply to this topic.
7 replies to this topic
Share this topic:
| More

#1 chemproc

chemproc

    Gold Member

  • Store Customers
  • 67 posts

Posted 16 October 2012 - 03:45 PM

Hello all,

I was wondering if anyone has worked on a vba code to hide the tables in a hysys 7.3 simulation.

Thanks.

Edited by edusegzy1, 16 October 2012 - 03:47 PM.


#2 Bobby Strain

Bobby Strain

    Gold Member

  • Members
  • 3,529 posts

Posted 16 October 2012 - 07:10 PM

You should buy the book by John Walkenback and learn a little VBA. It's about the best tutorial available.

Bobby

#3 chemproc

chemproc

    Gold Member

  • Store Customers
  • 67 posts

Posted 19 October 2012 - 09:47 AM

I got this code from aspentech. had to tweek it a little.
it works better when copy and pasted into the macro editor of HYSYS.

Sub Main

Dim hyApp As HYSYS.Application
Dim hyCase As HYSYS.SimulationCase
Dim hyFwsht As HYSYS.Flowsheet
Dim hyPFD As HYSYS.PFD
Dim hyPFDItems As HYSYS.PFDItems
Dim hyPFDItem As HYSYS.PFDItem

Set hyApp = GetObject(, "HYSYS.Application")
Set hyCase = hyApp.ActiveDocument
Set hyFwsht = hyCase.Flowsheet

Set hyPFD = hyFwsht.PFDs.ActivePFD

Set hyPFDItems = hyPFD.Items(pfdOperationTable, pfdVisible)

For Each hyPFDItem In hyPFDItems
hyPFDItem.Hidden = True
Next 'hyPFDItem

End Sub

#4 Bobby Strain

Bobby Strain

    Gold Member

  • Members
  • 3,529 posts

Posted 19 October 2012 - 02:06 PM

I guess that I misunderstood your question. But you went to the right place for a solution. I never use tables in my simulations except in rare instances. So, where did you store the procedure?

Bobby

#5 chemproc

chemproc

    Gold Member

  • Store Customers
  • 67 posts

Posted 19 October 2012 - 03:25 PM

Go to Tools>Macro Language Editor

#6 chemproc

chemproc

    Gold Member

  • Store Customers
  • 67 posts

Posted 19 October 2012 - 03:27 PM

...in HYSYS

#7 Bobby Strain

Bobby Strain

    Gold Member

  • Members
  • 3,529 posts

Posted 19 October 2012 - 07:49 PM

So, you run the procedure in HYSYS without using EXCEL? Well, I did a bit of research to answer my own question. I have used HYSYS since its introduction, but never created and stored a macro with the HYSYS editor. I always used visual basic or EXCEL VBA. For simple things like you are doing, HYSYS macro is best since it is stored in the same folder with the simulation. But if you need a lot of dialog, VB or VBA will be much easier to build the interface. As long as Microsoft supports VB6 we're in good shape. When that support ends, we will have to do things a bit different with the .net versions.

Bobby

Edited by Bobby Strain, 22 October 2012 - 10:00 AM.


#8 chemproc

chemproc

    Gold Member

  • Store Customers
  • 67 posts

Posted 02 November 2012 - 02:57 PM

Thanks Bobby. I agree with you!




Similar Topics