ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Referring to file no's from within an add-in gives problems (https://www.excelbanter.com/excel-programming/325687-referring-file-nos-within-add-gives-problems.html)

PaLPiTaTioN

Referring to file no's from within an add-in gives problems
 
I've got several Excel-files that contain sheets and code modules, bu
because there's a lot of code that is copied to all the excel files
I'm now working on a main file that contains the general data to b
used by all the other Excel files

I've created an add-in that contains a function HTML_Header tha
should write some text to a text file. In the main code I say

Dim iFileNum As Intege
iFileNum = FreeFil
Open "C:\test.html" For Output As #iFileNu
Call HTML_Header(iFileNum

and in the function HTML_Header these are the very first two lines o
code

[code:1:3f6bc40692]Print #iFile, "<html
Print #iFile, " <head
[/code:1:3f6bc40692

When I try to run this code, the first Print-statement in th
HTML_Header function gives error 52 "Bad file name or number". Doe
anybody know why I get this error? If I copy the function to th
normal Excel-workbook, everything works fine



All times are GMT +1. The time now is 05:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com