gint32
08-15-2017, 11:39 PM
Hi All/Gurus.
I have inherited an fairly complex excel (2010)system. The spreadsheet in Excel basically via VBA writes and reads data to various “.Dat” files in various sub folders via Texboxs and Userforms (only).
My issues is , I am not accustomed to writing vba in this way and I have stepped through the vba behind and find it really too complex for me presently (I am actually doubting that it was developed with just the standard MS VB for applications that comes with an office install). I thought I have a searched the Internet but I can’t find any examples of reading and writing via a variety of textboxes and Buttons on Userform’s and Buttons although I did find other examples but just not using userforms.
So I hoping someone out there has some experience in this area and able to cast some light or better yet provide me with a simple example of replicating this so I can expand on and begin the new learning curve.
Here is a sample of the VBA that runs from a form button somehow
Open C:\folder\file.dat" For Random Shared As 1 Len = 100 ' Also, whats the random and Len doing?
For Num_OF_Records = 1 To LOF(1) \ 364
Get #1, Num_OF_Records, Ent
EDate = Val(Format(EDate.A_Date, "yymmmdd"))
If ShowAll_Flag = 0 And EDate >= CurrentDate Then
GoSub Add_Row
Else
If ShowAll_Flag = 1 Then GoSub Add_Row
End If
Next
Close #1
Add_Row:
If Trim(Ent.)TmpID) = Range("EmpID") And Trim(Ent.mrk) <> "DELETED" Then
Row_Num = Row_Num + 1
With Ent
Range("'OReg'!A" + CStr(Row_Num)) = Trim(.A_Date)
Range("'OReg'!B" + CStr(Row_Num)) = Trim(.P_Prefer)
End With
End If
Return
I have inherited an fairly complex excel (2010)system. The spreadsheet in Excel basically via VBA writes and reads data to various “.Dat” files in various sub folders via Texboxs and Userforms (only).
My issues is , I am not accustomed to writing vba in this way and I have stepped through the vba behind and find it really too complex for me presently (I am actually doubting that it was developed with just the standard MS VB for applications that comes with an office install). I thought I have a searched the Internet but I can’t find any examples of reading and writing via a variety of textboxes and Buttons on Userform’s and Buttons although I did find other examples but just not using userforms.
So I hoping someone out there has some experience in this area and able to cast some light or better yet provide me with a simple example of replicating this so I can expand on and begin the new learning curve.
Here is a sample of the VBA that runs from a form button somehow
Open C:\folder\file.dat" For Random Shared As 1 Len = 100 ' Also, whats the random and Len doing?
For Num_OF_Records = 1 To LOF(1) \ 364
Get #1, Num_OF_Records, Ent
EDate = Val(Format(EDate.A_Date, "yymmmdd"))
If ShowAll_Flag = 0 And EDate >= CurrentDate Then
GoSub Add_Row
Else
If ShowAll_Flag = 1 Then GoSub Add_Row
End If
Next
Close #1
Add_Row:
If Trim(Ent.)TmpID) = Range("EmpID") And Trim(Ent.mrk) <> "DELETED" Then
Row_Num = Row_Num + 1
With Ent
Range("'OReg'!A" + CStr(Row_Num)) = Trim(.A_Date)
Range("'OReg'!B" + CStr(Row_Num)) = Trim(.P_Prefer)
End With
End If
Return