|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
howto do global attachment files
Does any one know howto do global attacment
Iam trying to do Call oItem.EMBEDOBJECT(1454, "", "c:\temp\*.txt" but it does not work could some one show me how to do this THX |
|
#2
|
|||
|
|||
|
U can't use "*" to represent any file with same extend name..U can get each filename that u want,and add it into your oItem..
|
|
#3
|
|||
|
|||
|
I have tried this also but it does not work could you show us how do you do this, what are the codes you are using
|
|
#4
|
|||
|
|||
|
OK!Give U a sample to show how to collect the wildcard file (like *.txt) in the special directory..
dim fso dim fFolder dim file set fso=createobject("Scripting.filesystemobject") if fso.FolderExists("C:\dir1") =true then Set fFolder = fso.GetFolder("C:\dir1") for each file in fFolder.files if ucase(right(file.path,3))="txt" then msgbox(file.path) endif next End If set file=nothing set fFolder=nothing set fso=nothing |
|
#5
|
|||
|
|||
|
I have tried your code but not sure where about or how on my program I can use them
Please note I am just a beginner please show me with what I know in my program, I'll apreciate your help. |
|
#6
|
|||
|
|||
|
OK! My code works by using vbscript language's filesystem ojbect.U can learn it on the msdn or vb help..I will expain my code now:
'define vbscript filesystem object dim fso dim fFolder dim file 'create fielsystem object set fso=createobject("Scripting.filesystemobject") 'check "C:\dir1" exists or not exists if fso.FolderExists("C:\dir1") =true then 'if "C:\dir1" exists,it will assign a folder object that represent this folder Set fFolder = fso.GetFolder("C:\dir1") 'asssign the file object in this directory,and search each file which filename contains "txt" for each file in fFolder.files 'if find,it will show it in the messagebox if ucase(right(file.path,3))="txt" then msgbox(file.path) endif next End If 'release the file object set file=nothing 'release the folder object set fFolder=nothing 'release the filesystem object set fso=nothing |
|
#7
|
|||
|
|||
|
Thx for explanation now I understand little more about vb codes
About your sample code, when I run your code I get compile error with a message "Ambiguous name detected Right" what can I do? and how can I resolve the problem, this is what I have create in c:\dir1 abc.txt, efg2.txt, lmnop.txt |
|
#8
|
|||
|
|||
|
OH!U must use the "Option Explicit" in the head of the code?If use it,u can only modify the define statement as:
dim fso as new filesystemobject delete the statement:set fso=createobject("Scripting.filesystemobject") Note:U must add the MS script runtime to the reference. |
|
#9
|
|||
|
|||
|
You have indicate the MS script runtime what is it and how can I add the MS script runtime to the refrence.
where about on your script I need to added |
|
#10
|
|||
|
|||
|
project->reference->Search MS script runtime-> add it...
|
|
#11
|
|||
|
|||
|
I am using excel 2000 and using tools>macro to run the macro
I can not find project->reference->Search MS script runtime-> add it... But I added from tools>macro>tools>refrence>search MS script runtime >it is added After doing this change still I get the same error message even with removing the previous line as you have mentioned Last edited by josephg : October 23rd, 2003 at 11:51 PM. |
|
#12
|
|||
|
|||
|
Can't use wildcard filename like *.txt in my code.My code is used to select some files which filename contain some special string like txt,And show the filename to user..
|
|
#13
|
|||
|
|||
|
How to receive attachment file as a correct format
When I send an attachment using vb (an EXCEL file ) I receive it as a non excel type format file
How can I receive it as a normal excel file type |
|
#14
|
||||
|
||||
|
Mel... What do you mean when you "send" an attachment. Are you mailing though VB and receiving a file that is not excel? This could probably use it's own post.
__________________
Fisherman "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein |
|
#15
|
|||
|
|||
|
file type attachment
Hi Fisherman
Yes, when I send attachment (Excel file) through VB I receive the attachment but I get it as a text file colour, not in Excel format colour and shape normally excel attachment is in green Also you mention about another post, please do not do this question will complement the ordinal question |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > howto do global attachment files |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|