Forum Discussion
sunnyschindler
Jul 25, 2023Brass Contributor
LOOKUP to include formatting with its Return Value? Formatting Code Function? non-VBA request
Without VBA, is it possible for LOOKUP to return formatting of its Return Value? It is much easier if Formatting Code Function (similar to CODE function) can be exposed to end user. I need to di...
bosinander
Aug 01, 2023Steel Contributor
sunnyschindler You're welcome 🙂 And good point about files with acitve content!
Users without Enterprise possibilities may analyse the macro as plain text (if withheld) before applying it.
Such xlsx version attached with the macro code as plain text on a sheet.
sunnyschindler
Aug 03, 2023Brass Contributor
bosinander Thanks for more help. But my VBA literacy is insufficient and needs to change line from
' Path = ThisWorkbook.Path & " \ " & tmpFile 'get path to a temp file in same folder
Path = TargetFolder & " \ " & tmpFile 'get path to a temp file in same folder
The Target Folder works for code as follows
'https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/freefile-function
Sub FreeFile_Example1()
Dim Path As String
Dim FileNumber As Integer
Dim TargetFolder As String
TargetFolder = "C:\Users\wongsunn\OneDrive - Schindler\Documents\scrap"
Path = TargetFolder & "\Articles2019File 1.txt"
FileNumber = FreeFile
Open Path For Output As FileNumber
Path = TargetFolder & "\Articles2019File 2.txt"
FileNumber = FreeFile
Open Path For Output As FileNumber
End Sub
Now I have to resolve error "Open Path For Output As #fileNo".
- bosinanderAug 03, 2023Steel Contributor
sunnyschindler Use a hard coded target folder of your choice instead of ThisWorkbook.Path
' path = ThisWorkbook.path & "\" & tmpFile 'get path to a temp file in same folder path = "C:\Users\wongsunn\OneDrive - Schindler\Documents\scrap" & "\" & tmpFile 'get path to a temp file