Prompt user to save Text file in certain location

Hi,

I have created an action button to pick some documents and write the contents into a Text file.
But how do I prompt the user to select the location to save the text file after I saved it in C:\?
I keeps getting OLE automation error at the line "Set myTxt = GetObject("C:\sampletxtfile.txt")".
Why?
Can someone enlighten me?
Thanks very much in advance!

Here is my scripts:
Dim sess As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim i As Integer, fileNum As Integer, fileName As String
Dim TxtFilePath As Variant, myTxt As Variant
      
Set db = sess.CurrentDatabase
Set dc = db.UnprocessedDocuments
      
If dc.Count = 0 Then
    Msgbox "Please select CCF forms before clicking this button!", 0+16, "Verification errors"
    Exit Sub
End If
      
fileNum = Freefile()
fileName = "C:\sampletxtfile.txt"
Open fileName For Output As fileNum

For i = 1 To dc.Count
   Set doc = dc.GetNthDocument(i)
   Write #fileNum, doc.P1(0), doc.T1(0), doc.DSO1(0), doc.DO1(0), doc.PS1(0), doc.PSG1(0), doc.RS1(0), doc.PO1(0), doc.POG1(0), _
   doc.RO1(0), doc.S1(0), doc.OI1(0), doc.CL(0)
Next

Close fileNum
Set myTxt = GetObject("C:\sampletxtfile.txt")
      
TxtFilePath = ws.OpenFileDialog(False, "Report 9 File Save as...", "", "c:", "sampletxtfile.txt")
If Not Isempty(TxtFilePath) Then
   Call myTxt.Saveas(TxtFilePath)
End If


kspuea
kspueaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

madheeswarCommented:
Dim files As Variant

files = workspace.OpenFileDialog(True, "File List", _
      "", "c:")


Is this what ur looking for?
0
kspueaAuthor Commented:
nope, not only that. I want to pick up the text file I generated previously and prompt the user to select a location to save it.
0
RanjeetRainCommented:
You can not use a GetObject on a .TXT document. GetObject works only on Documents that are being served by an OLE server such as MS Word, MS Excel etc.

Just use OPEN statement to deal with .TXT documents.
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

qwaleteeCommented:
Here's what your current logic is (even though it does not work):

1) Open a temporary text file
2) Gather data, and write text to file opened in step 1
3) Ask user where to save the file "permanently"
4) Save temporary file from steps 1 and 2 into new filename specified by user in step 3

This is what your logic should really be:
1) Ask user where to save file
2) Open file specified by user in step 1
3) Gather data, and write text to file opened in step 2

For step 1, use the ws.OpenFIleDialog method

Then use the file name returned by OpenFileDialog to do Open userSPecifiedFIleName for output as fileNum

That's it!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kspueaAuthor Commented:
Thanks very much, qwaletee!
It works wonderfully....  :-)
0
madheeswarCommented:
I think I gave solution first?

kspuea, bad idea not giving points to me.
0
qwaleteeCommented:
madheeswar,
You only gave him the OpenFileDialog code suggestion.  He already had OpenFileDialog in the original question.  His problem was really one of structure and understanding how LotusScript file handling worked.
0
RanjeetRainCommented:
Maddy, qwaletee's solution indeed was more comprensive. Yes you began, but qualetee did a good job afterwards. He has been awarded points for his clarity of explanation. This looks good.
0
madheeswarCommented:
OK. No problem.

I can understand it..

have a nice day
0
RanjeetRainCommented:
Thanks Maddy, same to you.
0
qwaleteeCommented:
If you really want points, I'm perfectly willing to give them up.
0
madheeswarCommented:
Qwaletee,
What a change? R u kiding?

If I want points, I will ask u. As I said before, first I need to reach 3000 points. Until then I will have this type of mind and thinking.

Thanks for your offer anyway.

I think Ranjit will be willing to take.
What Ranjeet?

0
RanjeetRainCommented:
Oh wow!!!! WOW WOW WOW!!!! Shall I prepone my bday? LOL ;-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.