Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Problem to the item

Posted on 2015-01-27
2
Medium Priority
?
101 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 46

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 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

597 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