View Full Version : How to show save as dailog box
ms06f
07-28-2012, 05:35 AM
How to do that , when I DblClick the image, the SAVE AS dailog box pop up and save file format is jpg.
Kenneth Hobs
07-28-2012, 06:10 AM
Sub Test_SaveAs()
SaveAs ThisWorkbook.path & "\Test.xls"
End Sub
Sub SaveAs(initialFilename As String)
With Application.FileDialog(msoFileDialogSaveAs)
.AllowMultiSelect = False
.ButtonName = "&Save As"
.initialFilename = initialFilename
.Title = "File Save As"
.Execute
.Show
End With
End Sub
Sub Test_SaveAs2()
SaveAs2 ThisWorkbook.path & "\Test.xls"
End Sub
Sub SaveAs2(initialFilename As String)
Dim filespec As String
filespec = Application.GetSaveAsFilename(initialFilename:=initialFilename, FileFilter:="Microsoft Excel files (*.xls), *.xls", Title:="Save As2")
If filespec <> "" And filespec <> False Then ActiveWorkbook.SaveAs filespec
End Sub
ms06f
07-28-2012, 07:39 AM
Thankyou for you help.
but my problem is when I double click the image (inside userform) the save as dailog box pop up and I can save the image to other location in jpeg file.
If I am understanding correctly, we could use SavePicture to save the image control's picture as a bitmap. Borrowing from Kenneth, maybe something like:
Option Explicit
Private Sub Image1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
If SaveAs2("MyTest.bmp") Then Unload Me
End Sub
Private Function SaveAs2(InitialFilename As String) As Boolean
Dim filespec As String
filespec = Application.GetSaveAsFilename(InitialFilename:=InitialFilename, FileFilter:="BitMap (*.bmp), *.bmp", Title:="Save As BitMap")
If filespec <> "" And filespec <> "False" Then
SavePicture Me.Image1.Picture, filespec
SaveAs2 = True
End If
End Function
Does that help?
Mark
ms06f
07-28-2012, 05:06 PM
Yes, thankyou very much for your help.
An other problem, original picture size is 140KB but after run VBA save as picture to MyTest.bmp / MyTest.jpg....
The picture is too large (file size more than 60MB)
WHY?
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.