Hello I am trying to make a Macro In Solidworks vba. To get new Product Number. Each time when the macro Works It opens new session. How to solve this. Thanks in advance.
Code
Set Con_1C = CreateObject("V82.Application")
Con_1C.Connect ("Srvr=SUNUCU;Ref=Production;Usr='Adm';Pwd=123456")
I think you have 2 options: 1) if this environment allows you to store value in global variable - you can create COM-connection once, store it in global variable and use it later in next iterations. However, connection can be terminated for many reasons and you should consider it in your code. And it is not a good practice. 2) in this situation would be way much better to use a web-services or HTTP-services. It works faster and more predictable.
Pages:1
Users browsing this topic (guests: 1, registered: 0, hidden: 0)