Use the following function:
Function Format(vExpression, sFormat)
set fmt = CreateObject("MSSTDFMT.StdDataFormat")
fmt.Format = sFormat
set rs = CreateObject("ADODB.Recordset")
rs.Fields.Append "fldExpression", 12 ' adVariant
rs.Open
rs.AddNew
set rs("fldExpression").DataFormat = fmt
rs("fldExpression").Value = vExpression
Format = rs("fldExpression").Value
rs.close
Set rs = Nothing
Set fmt = Nothing
End Function
Please make sure that the dll library file file "MSSTDFMT.dll" in your operating system.
Its observed that in the recent builds of Windows 7 its not coming by default.
In that case, download the dll file and register using the follwowing steps
1. Download the file
2. Copy the DLL File into System32 folder
3. Open command prompt as administrator and navigate to System32 folder
4. Run "regsvr32.exe "Dll File Name"
5. A confirmation will be shown as the dll gets registered successfully
Function Format(vExpression, sFormat)
set fmt = CreateObject("MSSTDFMT.StdDataFormat")
fmt.Format = sFormat
set rs = CreateObject("ADODB.Recordset")
rs.Fields.Append "fldExpression", 12 ' adVariant
rs.Open
rs.AddNew
set rs("fldExpression").DataFormat = fmt
rs("fldExpression").Value = vExpression
Format = rs("fldExpression").Value
rs.close
Set rs = Nothing
Set fmt = Nothing
End Function
Please make sure that the dll library file file "MSSTDFMT.dll" in your operating system.
Its observed that in the recent builds of Windows 7 its not coming by default.
In that case, download the dll file and register using the follwowing steps
1. Download the file
2. Copy the DLL File into System32 folder
3. Open command prompt as administrator and navigate to System32 folder
4. Run "regsvr32.exe "Dll File Name"
5. A confirmation will be shown as the dll gets registered successfully
No comments:
Post a Comment