How to get the path of a file I have created the file like this
Dim filepath As String
Dim filenum As Integer
filepath$=Cstr(uidoc.FieldGetText(“uniqueid”))&“.xls”
filenum%=Freefile()
I have open the file and exported
Open filepath$ For Output As filenum%
I have saved and close
now I need to attach a file to the richtext field
Set item=doc.GetFirstItem(“LongDescription”)–richtextfield
If (item.Type= RICHTEXT) Then
Set object =item.EmbedObject( 1454, "",filepath$) //I got the error here must specify the path of a file
Call doc.Save(True,False)
End If
can anyone give an idea?
thanks
Subject: how to get the path of a file
you must use the whole path of the file like c:\temp\one.xls,seeing your code you must have used like
Set object =item.EmbedObject( 1454, “”,“one.xls”)
which is causing the error?
instead use
Set object =item.EmbedObject( 1454, “”,“c:\temp\one.xls”)
Subject: RE: how to get the path of a file
thank youits working fine
but how to get that path "c:\documents" through programetically
when i was creating the file
here
Open filepath$ For Output As filenum%
immediately how to get the path where it is created.
thanks alot
Subject: RE: how to get the path of a file
Use a full path when creating the file as well. The Open statement will supply a default path ONLY if you don’t use a full path in the filename part.
Subject: RE: how to get the path of a file
thank youyes but how to get that default path only
thanks
Subject: RE: how to get the path of a file
Don’t rely on a default – create your own path so you know where it is.
Subject: RE: how to get the path of a file
Curdir$ should get you the default; but as Stan says, you should really specify the path. The default directory is usually your Notes executable directory, and it’s a bad idea to write files there because you risk overwriting important files that might happen to have the same name.
You might find this helpful: a way to manage temporary files in LotusScript.
Subject: RE: how to get the path of a file
You can use following code in your coding…
'Set fileToImport variable to the path where the existing excell sheet is located
fileToImport = ws.OpenFileDialog(False, "Select Employee Information file to Import","","c:\")
If Isempty(fileToImport) Then
Exit Sub
End If
this will give you the dialogbox from which you can select your file…where "C:" the path where you store the file. I think this will be definitely help you…
Subject: RE: how to get the path of a file
Not if he uses the default path to write the file, it won’t – the user would have to poke around the file system looking for the file. As well,a dialog isn’t going to be of much help in a scheduled or web agent (which this seems very likely to be).