Thursday, 9 November 2017

VBA Add date by clicking Month Combobox


‘to add month date wise in combobox

Private Sub Req_Month_Change()

a = COmbobox_Month.Value
b = 1 & "-" & a & "-" & 17
c = WorksheetFunction.EoMonth(b, 0)
d = Format(c, "dd")
Combobox_Date.Clear
For i = 1 To d

Combobox_Date.AddItem i

Next i

End Sub

********************************************************************************************************************



Create text file

Sub CreateAfile

Set fs = CreateObject("Scripting.FileSystemObject")

Set a = fs.CreateTextFile("c:\testfile.txt", True)

a.WriteLine("This is a test.")

a.Close

End Sub





Sub OpenTextFileTest


Const ForReading = 1, ForWriting = 2, ForAppending = 3


Dim fs, f


Set fs = CreateObject("Scripting.FileSystemObject")


Set f = fs.OpenTextFile("c:\testfile.txt", ForAppending,TristateFalse)


f.Write "Hello world!"


f.Close


End Sub

No comments:

Post a Comment

JOTHIDAM KARPOM VANGA