Solved

Problem to the item

Posted on 2015-01-27
2
91 Views
Last Modified: 2015-01-28
Hi,
I don't know why I get the error attached,

to these codes
Public Function vbascr2main() Set objFSO=CreateObject("Scripting.FileSystemObject") : out1="z:\cmp2\list1.txt" : Set objFile = objFSO.CreateTextFile(out1,True) : Dim x1 : For each x1 in AVX.Item : objFile.Write x1.Name & "<br />" : Next : objFile.Close : End Function

Open in new window

0
Comment
Question by:HuaMinChen
2 Comments
 
LVL 45

Expert Comment

by:aikimark
ID: 40574464
Try this.
Public Function vbascr2main() 
  Set objFSO=CreateObject("Scripting.FileSystemObject")
  out1="z:\cmp2\list1.txt"
  Set objFile = objFSO.CreateTextFile(outFile,True)
  Dim x1
  For each x1 in AVX.Item
    objFile.WriteLine x1.Name
  Next
  objFile.Close
End Function

Open in new window

0
 
LVL 20

Accepted Solution

by:
ltlbearand3 earned 500 total points
ID: 40574469
At first glance I don't see AVX as defined in your code  Therefore it will error when you try and loop through it.  I also don't recommend putting all that in one line of code as it makes it for someone who follows you to to read it.  I recommend you break it down, something like this:

Public Function vbascr2main()
	Dim x1

	Set objFSO=CreateObject("Scripting.FileSystemObject")
	out1="z:\cmp2\list1.txt"
	Set objFile = objFSO.CreateTextFile(out1,True)

	For each x1 in AVX.Item
		objFile.Write x1.Name & "<br />"
	Next
	
	objFile.Close
End Function

Open in new window


What error do you receive?
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now