Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic System Architect (steve huntington)
Decrease font size
Increase font size
Topic Title: VBA Problem - CreateTextFile
Topic Summary:
Created On: 27-Aug-2008 13:24
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 27-Aug-2008 13:24
User is offline View Users Profile Print this message


Peter Crabb-Wyke

Posts: 73
Joined: 3-May-2007

This code for creating an output file has been copied from macro to macro without problem under Windows 2000. My PC has just been replaced with an XP machine and we are now having problems. Curiously the code worked yesterday with the same machine.

Set fs = CreateObject("Scripting.FileSystemObject")
fs.CreateTextFile strOutputFileName
Set f = fs.GetFile(strOutputFileName)
Set ts = f.OpenAsTextStream(ForWriting)

When run the macro fails on the second line with a message:
Method 'CreateTextFile' of object 'IFileSystem3' failed

I have tested this both where the file exists and where a new file is created.
Report this to a Moderator Report this to a Moderator
 28-Aug-2008 14:13
User is offline View Users Profile Print this message


Peter Crabb-Wyke

Posts: 73
Joined: 3-May-2007

Well I identified the problem. The scripts were coded to find the user's "My Documents" folder and save output there. This worked fine with Win2K but is failing with our implementation of XP. I imagine that something doesn't like the embedded blank in the file name.

Report this to a Moderator Report this to a Moderator
 28-Aug-2008 17:19
User is offline View Users Profile Print this message


Arif Hussain

Posts: 53
Joined: 22-Dec-2005

Tried it on my XP SP3 pc and encountered no problems with blank like below:


strOutputFileName = "C:\Documents and Settings\" & "userid" & "\My Documents\Docs\PCW extract.txt"
Report this to a Moderator Report this to a Moderator
 29-Aug-2008 12:04
User is offline View Users Profile Print this message


Peter Crabb-Wyke

Posts: 73
Joined: 3-May-2007

I was using the system variable that gives the path and this was where the problem was. Depending on the user My Documents may be on the c drive or on a network drive. Maybe it was the variable itself that was the problem.
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic System Architect forum.
There are currently 0 users logged in.
The most users ever online was 16 on 30-Oct-2008 at 14:46.
There are currently 0 guests browsing this forum, which makes a total of 0 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.