View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default writing to text file

Watch out if the filename contains dots.

book1.generated.by.tim.on.2007.07.13.xls



Tim wrote:

Msgbox Split(ThisWorkbook.Name, ".")(0)

Tim

"ADK" wrote in message
...
ThisWorkbook.Name returns the name of the file name....but with .xls

Is there a way to only return the file name with the extension?


UserName = Environ("USERNAME")
CpuName = Environ("COMPUTERNAME")
WhatOffice = Environ("USERDOMAIN")
MyFullName = ThisWorkbook.FullName
Contents:=True, UserInterfaceOnly:=True
Open "W:\PL10\PDSRlogs" & "\usage-" & ThisWorkbook.Name & ".log" For
Append As #1
Print #1, UserName, WhatOffice, CpuName, Now, MyFullName
'Print #1, Application.UserName, Now
Close #1


--

Dave Peterson