Write to text file - OK a admit defeat

birchs92

New Member
Joined
Nov 1, 2007
Messages
44
Dear All

I am using the code below to write "xxxx" to a text file (by way of a test)

Sub test()
Dim full As String
full = "xxxx"

' Declare a FileSystemObject.
Dim fso As New FileSystemObject

' Declare a TextStream.
Dim stream As TextStream

' Create a TextStream.
Set stream = fso.CreateTextFile("c:\string.log", True)

'write to file
stream.Write full

'close steam
stream.Close

End Sub

I have the 'Microsoft Scripting Runtime' reference ticked

Excel version - Excel 20017

Get error - "Automation error Library not registered"


Any ideas !!! Thanks in advance.. Simon
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Then open a command prompt using the Run As administrator option, navigate to C:\Windows\System32 and run:
regsvr scrrun.dll

and see if the message says it registered successfully.
 
Upvote 0
Thanks for everybody's help, I re-registered DLL using REGSVR32 "c:\Windows\system32\scrrun.dll" and now works

Thanks once again, Simon
 
Upvote 0

Forum statistics

Threads
1,226,224
Messages
6,189,728
Members
453,566
Latest member
ariestattle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top