|
-
Aug 14th, 2000, 11:31 AM
#1
Thread Starter
Member
This may be easy but I have no clue. On my program I have a button which the user clicks and a pdf file comes up. My question is how do you allow the user to save a pdf file by a click of a button. I tried to do the common dialog box and just put the filename that they want to save in their folder but it doesn't save. Here is my code below:
dlgSave.FileName = "16CM32MDOSummary(50).pdf"
dlgSave.Flags = cdlOFNNoChangeDir Or cdlOFNHideReadOnly Or _
cdlOFNOverwritePrompt Or cdlOFNPathMustExist
dlgSave.Filter = "PDF Files (*.pdf)|*.pdf"
dlgSave.FilterIndex = 1
dlgSave.CancelError = True
On Error Resume Next
dlgSave.ShowSave
If Err.Number <> 0 Then
Exit Sub
End If
Please someone help me.
There are numerous of files they want to be able to save in their directories.
Thanks in advance
-
Aug 14th, 2000, 11:42 AM
#2
Frenzied Member
Im not sure, how to save a file, and I don't know how megatron hasn't been to this post yet, but this shows how to open the save prompt... http://www.vbsquare.com/tips/tip353.html
-
Aug 14th, 2000, 12:24 PM
#3
The common dialog control does not actually save a file. You must do this in code using standard VB statements (you determine the name of the file to save after the user is done interacting with the dialog box, i.e., after the ShowSave method). Are you allowing the user to modify the pdf file or just view it? If the user can't modify the file, then you need not save it.
"It's cold gin time again ..."
Check out my website here.
-
Aug 14th, 2000, 12:40 PM
#4
Fanatic Member
to save it use the
Code:
Dim File as Integer
File = FreeFile
Open "File" for Binary as #File
'use Put to write to Binary file
Close #File
you must have the data in a byte array to write it. if not, then you must figure out how to get it into one!
GWDASH
[b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]
-
Aug 14th, 2000, 12:48 PM
#5
Thread Starter
Member
I want them to be able to save it into whatever directory they want it to be saved in. Just as a save as function do in windows.
-
Aug 14th, 2000, 01:56 PM
#6
If you are using a CommonDialog control, the path is stored in the filename property. So to save your file in that path, you would use:
Code:
Open CommonDialog1.filename For Binary As #1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|