OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > Corel Photo-Paint VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 27-06-2003, 09:14
greenee
Guest
 
Posts: n/a
Default Open - Resize - Savefile in Photo Paint

Hi everyone
Thanks very much for all your help, so far, via this site, the forum and other forums too.

I am trying to save a JPG file from a VBA script, but when it gets to the save part, I always get the compression/filter dialog box, therefore I can't let the computer get on with the job (converting about 3000 photos to a smaller size and then saving) without having to be by the computer to push the OK button. Is there any way you can help me with this problem.

I have scoured the CDRVBA group but can't seem to find this, apart form unanswered similar questions. I also looked at the script for the file converter but can't seem to work out the last part, if file type = 744 then etc etc......I know the 744 is the JPG file type reference but in my code it doesn't like the .filesave. 744,0 part when I put it in.

I guess that maybe something that would return a YES or OK when the dialog box appears would do the trick, but I don't know what the dialog box is called.

If you could help I would greatly appreciate it.
Many thanks
Rob
========================================================================================
Sub Resample_Longest_side_600pixel()
Dim w As Long, h As Long
Dim vw As Long, vh As Long
vw = 600 ' Desired width
vh = 600 ' Desired height
w = ActiveDocument.SizeWidth
h = ActiveDocument.SizeHeight
If w * vh \ h * vw Then
h = h * vw \ w
w = vw
Else
w = w * vh \ h
h = vh
End If
ActiveDocument.Resample w, h, True
End Sub
========================================================================================
Sub File_open_change_size_save_close()

Dim File As String 'declare string needed for storing the filename of each JPG doc
Dim Folder As String 'declare string for the folder where the JPG files are found
Dim Doc As Document 'declare a document variable for any JPG docs that are opened

Folder = "G:\Photo's\Convert_Photos\" 'set folder to location of where your JPG files are
File = Dir(Folder & "*.JPG") 'the "Dir" command will take the the first file from the folder that
'you pass to it. Here we use a wildcard to pickout any .JPG
'documents. The File string will now equal the first JPG
'file that was found

If File <> "" Then 'only proceed if a JPG file has been found
Do
Set Doc = OpenDocument(Folder & File) 'open the JPG file returned by Dir command
'you must include the folder like this too because
'Dir doesn't return the full path to the file
With Doc 'With the file we just opened, do the following...from here you
Resample_Longest_side_600pixel 'Run the macro "Resample_Longest_side_600pixel" (above)
.Save 'Save file FROM HERE IS WHERE I HAVE THE PROBLEM
.Close 'close the file
End With

File = Dir 'now the important bit! we say File=Dir in order to point
'to the next JPG file in the folder
Loop Until File = "" 'loop back and perform the same tasks on this new file and
'stop looping as soon as no more files are Left
End If

End Sub
Reply With Quote
  #2  
Old 27-06-2003, 19:20
wbochar
Guest
 
Posts: n/a
Default Read the other Articles; it may help you...

Quote:
Originally Posted by Alex
Kai,

Document.SaveAs function in PP11 returns a filter object which needs to be used to finish the save operation:

Dim flt As Object
Set flt = doc.SaveAs(varLargeFile, cdrJPEG)
flt.Finish

Or just simply:

doc.SaveAs(varLargeFile, cdrJPEG).Finish

For more information on how to use the filter object returned, please refer to the following article (which was written for Draw 10, but also applies to Draw 11 and Paint 11): http://www.oberonplace.com/vba/exportex.htm

I hope it helps.
The link above shows what things you can set for each format.
Reply With Quote
  #3  
Old 28-06-2003, 04:54
greenee
Guest
 
Posts: n/a
Default SaveAs in PP10

Thanks for that, but I should have said that I have PP 10, and it doesn't seem to like the Doc.SaveAs () command. I get a message saying expected function or variable.

I shall keep trying

Regards
Rob
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Corel Photo Paint 11 Document Events problem cyrilgupta Corel Photo-Paint VBA 1 07-11-2004 13:51
color profile problem in Photo Paint 9 flip Corel Photo-Paint VBA 2 11-07-2003 04:55


All times are GMT -5. The time now is 20:06.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com