Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I am trying to run some very simple code to write to a file on my host PC using an Excel VBA macro: Sub TestFileOpening() Dim FileNumber As Integer FileNumber = FreeFile() Open "C:\TEST.TXT" For Output As #FileNumber Write #FileNumber, "This is a sample." Close #FileNumber End Sub The 'write' statement fails with 'Run-time error '54' Bad file mode'. This code runs fine on a colleague's machine. I have tried setting the Excel security level to medium or low but still get the error. I think the code is correct so I suspect a security issue but I don't know where else to look. I am running Excel 2003 SP1 on Windows XP Prof SP2. Can anyone help me please? David |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Open a print output sent to file | Excel Discussion (Misc queries) | |||
CSV output file | Excel Programming | |||
VBA help to output a file | Excel Programming | |||
"Unable to Open File" - excel output of Datagrid <-help needed | Excel Programming | |||
Diff. btw Open [path] For OUTPUT vs. For INPUT | Excel Programming |