get date and hour in VBA to a custom param

get date and hour in VBA to a custom param

j.romo
Advocate Advocate
799 Views
1 Reply
Message 1 of 2

get date and hour in VBA to a custom param

j.romo
Advocate
Advocate

Hello guys

Im trying to do a custom plug in to get the time and date of the start of a process by clicking a button when my CNC programmers star programming a part in the shop and I want another button to get the time and date of the end of the process to get the total amount of hours the task took and send the info to a spreadsheet. 

I can get the date but not the hours on the custom Iproperty 

is there a way to do this?

Here is my code

 

Dim datINICIO As String

Dim datFIN As Date
Dim datTOTAL As Double





Private Sub CommandButton1_Click()

datINICIO = DATESTRING
 ' Get the active document.
    Dim doc As Document
    Set doc = ThisApplication.ActiveDocument

    ' Get the custom property set.
    Dim customPropSet As PropertySet
    Set customPropSet = doc.PropertySets.Item( _
     "Inventor User Defined Properties")

Dim customProp1 As Property


Set customProp1 = customPropSet.Item("TEST DATE STRING")

  ' Set the value of the property.
    customProp1.Value = datINICIO




End Sub
0 Likes
Accepted solutions (1)
800 Views
1 Reply
Reply (1)
Message 2 of 2

MechMachineMan
Advisor
Advisor
Accepted solution

There are some mighty fine resources all over the internets for this sort of generic vba (and not inventor exclusive) task.

 

https://www.tutorialspoint.com/vba/vba_date_time.htm


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type