Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a form to convert wmf to jpeg or gif in VB behind button

Status
Not open for further replies.

Triacona

Technical User
Jun 11, 2009
462
GB
Dear all,

I am trying to create a form that will take a wmf file and convert it to jpg or gif.

So far my for has a button, Convert, a txt box,txtPath
The path is default to where my image is stored.

I there any way in VB code behind the button to do the conversion depending on the path and filename given in the txtPath text box.

Thank you for your help [smile]

Thank you,

Kind regards

Triacona
 
I'm not sure how to carry out the conversion itself, but as far as determining if the conversion is needed based on the path or filetype I think a regular expression would be you best bet. Simply analyze the file path/file name/extension for a particular pattern and process accordingly. I'm new to VBA so I've yet to get a chance to use them, but from I've seen they're definietly supported.


The string comparison operators might also be worth looking into:

 
Actually you're probably best of using the LIKE operator, like so:

Code:
If strFileName LIKE "*.jpg" Then
 'Do conversion for Jpg files
End If

I hope this was something similar to what it was you were looking for.
 
Thanks for your reply Chunter33[smile]

The path has the file name as to what I want to convert...
i.e. c:\images\wmf1.wmf
I want to convert wmf to good quality jpg or png or gif.

So if I click the button, it will take the image and convert it to the above file formats.

Thanks again for your help[bigsmile]


Thank you,

Kind regards

Triacona
 
Dear All,

Is there any code in VB for converting wmf to jpg?
I wouldn't know where to start?

Thanks [smile]

Thank you,

Kind regards

Triacona
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top