Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / If ount = 0 Then MsgBox "No files were returned

If ount = 0 Then MsgBox "No files were returned

Computer Science

If ount = 0 Then
MsgBox "No files were returned."
Else
MsgBox "The list is complete. " & Chr(13) & Chr (10) &
"Found " & FileCount & "files" & Chr (13) 7 Chr(10) &_
"Occupying" & Int(SumDiskSpace / 100000) / 10 & "MB"
End If

If FileCount result is 50, then I would want that sum to appear in cell A5 on an Excel spread sheet. Can someone help me with the code to do this? Attached is an excerpt from the project I am working on.

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

The first step is to create a reference in our project to Microsoft Excel 11.0 Objects Library (COM reference).

' CREATING NEW EXCEL.APPLICATION
If exc Is Nothing Then
MsgBox("ERROR: EXCEL couldn't be started")
Return
End If

' MAKE APPLICATION VISIBLE
exc.Visible = True

' GET THE WORKBOOKS COLLECTION:
Dim workbooks As Workbooks = exc.Workbooks
Dim workbook As _Workbook = workbooks.Add(XlWBATemplate.xlWBATWorksheet)

' GET THE WORKSHEETS COLLECTION:
Dim sheets As Sheets = workbook.Worksheets
Dim worksheet As _Worksheet = CType(sheets.Item(1), _Worksheet)
If worksheet Is Nothing Then
MsgBox("ERROR: worksheet == null")
End If

' SET THE VALUE FOR CELL:
Dim range1 As Range = worksheet.Range("A5", Missing.Value)
If range1 Is Nothing Then
MsgBox("ERROR: range == null")
End If

Dim args1(1) As [Object]
args1(0) = FileCount

range1.Value = args1

Please use this google drive link to download the answer file.       

https://drive.google.com/file/d/1zuI_G3jt__ugaX-6E1D4bTWmaKWZjus5/view?usp=sharing

Note: If you have any trouble in viewing/downloading the answer from the given link, please use this below guide to understand the whole process. 

https://helpinhomework.org/blog/how-to-obtain-answer-through-google-drive-link