Replacing file name
- From: NIDU <nidu50@xxxxxxxxxxx>
- Date: Wed, 2 Apr 2008 03:29:48 -0700 (PDT)
My query is about a portion of my vbscript, in which i am trying to
replace the filename that i save in excel file.
FirstFile= ProjectDoc.GetFirstSourceFile()
This function gives the drive+path+file name of the source file in my
db. I use this code in the begining of my script
Afterwards ,In my script the strings of this source file are exported
to an excel file.
If i print the path of this FirstFile the result will be.
E:\code\Properties\UltResComplexQueryUI.resx
At the end of the script i want to save that excel file according to
the name of the source file i-e
UltResComplexQueryUI
to save an excel file in vbscript i use the following code.
objexcel.ActiveWorkbook.SaveAs("c:\Documents and Settings\nakhan
\Desktop\UltResComplexQueryUI
..xls")
This is all manual typing.
Now there are 3-5 source files in my db. which are exported to
different excel files, each of which has to be saved according to the
name of its source file.
i want my script to pick UltResComplexQueryUI
from
FirstFile=E:\code\Properties\UltResComplexQueryUI.resx
and save it
in
(This position) objexcel.ActiveWorkbook.SaveAs"c:\DocumentsandSettings
\nakhan\Desktop\UltResComplexQueryUI
..xls")
automatically. And i want this to happen with all the rest of source
files.
Now to get UltResComplexQueryUI from E:\code\Properties
\UltResComplexQueryUI.resx
I use the mid function i-e
FirstFile=mid(FirstFile,20,20) `20 is the position of U and
next 20 is the length.
The result will be FirstFile=UltResComplexQueryUI
now when i write
objexcel.ActiveWorkbook.SaveAs"c:\DocumentsandSettings\nakhan\Desktop
\FirstFile( or & FirstFile).xls")
it doesnt replace FirstFile
it saves the excel file as FirstFile.xls.
Please Help! i think instr function can be used but i dont know how to
use it.
.
- Follow-Ups:
- Re: Replacing file name
- From: Paul Randall
- Re: Replacing file name
- From: ekkehard.horner
- Re: Replacing file name
- Prev by Date: DateLastModified, but what "date" ?
- Next by Date: Re: backup Event log & clear
- Previous by thread: DateLastModified, but what "date" ?
- Next by thread: Re: Replacing file name
- Index(es):
Relevant Pages
|
Loading