Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have an excel file that contains that Main(). I have WriteLog(fnum,
message) function in a different excel addin file .xla. When I use WriteLog to write to a already opened file I get "Bad file or number". Apparently, the file number is not available in that module before entering into the module in the addin. Sub Main() REPORT_FILE_NUMBER = FreeFile Open ThisWorkbook.Sheets(1).Range("outputfile").value For Output Access Write As #REPORT_FILE_NUMBER Print #REPORT_FILE_NUMBER, "My message" '<== This works fine WriteLog( REPORT_FILE_NUMBER, "My message" ) Print #REPORT_FILE_NUMBER, "My message" '<== This works fine also!! Close #REPORT_FILE_NUMBER End Sub 'This sub is in an excel addin. It works fine if not an excel addin but a different module in the same file. Sub WriteLog( Optional dest, msg As String ) Print #dest, msg '<=== I get error number 52, bad file name or number here End Sub Please help. Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
entering a number and having a word appear in excel | Excel Worksheet Functions | |||
Module not file when open the excel file | Excel Discussion (Misc queries) | |||
auto move cursor after entering number in excel | Excel Worksheet Functions | |||
after entering certain number of times wrong password file can cur | Excel Discussion (Misc queries) | |||
entering 16 digit number in Excel suffix 0 comes automatically | Excel Discussion (Misc queries) |