Thank You! This video is useful, since I was not aware that an excel report could be generated or the fact that a loops could be separated into subsections. I'm sure this information will come in handy later on.
@harjeetguitar
8 жыл бұрын
When i am running program- 'creating of html file 'its giving me error " path not found" but the path is correct : code: Set objFile=ObjFSO.CreateTextFile("C:\Users\hsingh\Desktop\vbscript\" &Date&".html",True) what is the issue? In the same time when i am directly hard coding the file name its working fine code: Set objFile=ObjFSO.CreateTextFile("C:\Users\hsingh\Desktop\vbscript\aaa.html",True)
@QA1
8 жыл бұрын
+Harjeet Singh I changed the path to test your first line of code and it worked fine. Ensure that objFSO is created before you execute this code: Set objFSO = CreateObject("Scripting.FileSystemObject") If you still get the "path not found" error, look carefully at the path for missing or extra character(s). You can use the objFSO.FolderExists("C:\Users\hsingh\Desktop\vbscript") function to check if the path actually exists or not.
@harjeetguitar
8 жыл бұрын
+Software and Testing Training Hi , I rechecked for the path with FolderExists and i found that program is able to locate the path but for creating html file its not able to find path. please have a look at this whole code Option Explicit Dim ObjFSO,objFile Set ObjFSO=CreateObject("Scripting.FileSystemObject") Set objFile=ObjFSO.CreateTextFile("C:\Users\hsingh\Desktop\vbscript\" &Date &".html",True) 'Set objFile=ObjFSO.CreateTextFile("C:\Users\hsingh\Desktop\vbscript\aaa.html",True) WriteHead WriteBody Sub WriteHead With objFile .WriteLine("") .WriteLine("") .WriteLine("Report") .WriteLine("") .WriteLine("body{color:red;font-size:30px;background-color:honeydew}") .WriteLine("") .WriteLine("") End With End Sub Sub WriteBody With objFile .WriteLine("") .WriteLine("Harjeet Singh Rocks on" &Date &"") .WriteLine("") .WriteLine("") End With End Sub
@QA1
8 жыл бұрын
+Harjeet Singh This code looks fine. I think that the problem is with the Date function. It returns a date with hyphens on my machine e.g. 4-28-2016. On your machine, the format may be different e.g. 4/28/2016. Therefore, it looks for sub-folder 4 of vbscript folder etc. In your code, substitute Date with Replace(Date,"/","-"). Or instead of Date, put Hour(Now)
@harjeetguitar
8 жыл бұрын
+Software and Testing Training Hi,changing of date format from taskbar is giving me the result and also replacing with Hour(Now) working fine but still facing problem while replacing Date format
@QA1
8 жыл бұрын
+Harjeet Singh Good to know that you are able to create the html file with dynamic name. If you want to know your current date format, you can put the statement, MsgBox (Date). Instead of Date, you can put Replace(Date,,) to remove any invalid character in filenames like / < > * ?. You can read about Windows filenames at msdn.microsoft.com/en-us/library/aa365247#file_and_directory_names
@harjeetguitar
8 жыл бұрын
"if i=5 Then Exit for"--we can also write this statement to break the loop ..then why we are using wend?
@QA1
8 жыл бұрын
+Harjeet Singh What you have said is true. While...Wend is the simpler loop. This loop just runs repeatedly while a condition stays true.
Пікірлер: 11