View Full Version : vb prompt user to save file as when export owc chart to gif

09-01-2004, 03:40 PM
I have a method which works perfectly fine to export office web charts to gif and save them on the c drive or a drive which i allow the user to specify.

i am NOW being told that this isn't good enough and i need a 'save as' dialog box to pop up to browse through the users directory so they can choose teh location..

Can't find any information on this on the net. Any ideas?

Badly stuck
This method i have so far is as follows:
Sub export()
On Error Resume Next

answer = MsgBox("Would you like the image saved on your C drive? "&vbcrlf&"Click ""No"" to specify location",3)

If not Err then

if( answer = 7) then
typed_location = InputBox("Enter location of file e.g. H:/ Default is C:/ ")
if(typed_location <> "") then
picturename = typed_location & "faultPrsChart"&Day(Date)&"_"&Month(Date)&"_"&Year(date)&".gif"
ChartSpace1.ExportPicture picturename, "gif", 600, 350
if Err = 0 then
end if
end if
elseif answer = 6 then
picturename = "C:\faultPrsChart"&Day(Date)&"_"&Month(Date)&"_"&Year(date)&".gif"
'alert( Err )
ChartSpace1.ExportPicture picturename, "gif", 600, 350
if Err = 0 then
end if
end if
end if
End Sub </code>

09-02-2004, 01:47 PM
This may help (common theme among them is "MSComDlg.CommonDialog"...search Google for more/better info)





VBScript from the above link:

' Shows a MS common dialog. Used to choose a filename.
' Arguments:
' ttl the title of the dialog.
' fltr the filter string.
' initDir the initial directory in which to open from/save to.
' dlgtype the type of dialog to show. Only open and save are allowed.
' Returns the fully qualified path and file name.
function CommonDialog(byval ttl, byval fltr, byval initDir, byval dlgtype)
CommonDialog = ""
dim errMsg
with dlg
.cancelerror = false
.dialogtitle = ttl
.filter = fltr
.filterindex = 2
.initdir = initDir
.maxfilesize = 260
select case lcase(dlgtype)
case "open"
case "save"
case else
errMsg = replace(getResource("dlgerror"), "`dlgtype`",dlgtype)
' ShowMsg in vbscript_shell.vbs
ShowMsg errMsg, vbcritical + vbokonly
wscript.quit 1
end select
CommonDialog = .filename
end with
end function