How to open .jpg picture using Macro

L

Launchnet

I use the following macro to open excel files. Can this be modified to open
a picture ppppp.jpg ?

. . . or, can someone help me with a new macro that can open pictures
. . . I would still like to have the file checking options to see if already
open and if file actually exists.

Thanks
Matt @ Launchnet

Sub NewExcelWithWorkbookFantastic()
Dim oXL As Object 'This is needed to open a new instance of Excel.
'Without it, the file is only opened as a new Window
Dim testFileFind
Dim oWB As Object

If FileAlreadyOpen("c:\extrafiles\fantastic.xls") = True Then
MsgBox "File is alreaady open"

End
Else

'The following tests for the existance of the file
testFileFind = Dir("c:\extrafiles\fantastic.xls")

'If the file is not found there will be nothing
'in the variable and processing ends.
If Len(testFileFind) = 0 Then
MsgBox "You do not have this file in C:\extrafiles\"
End
End If

'THIS LINE OF CODE OPENS THE NEW INSTANCE OF EXCEL.
Set oXL = CreateObject("Excel.Application")

'THIS LINE OF CODE MAKES THE NEW INSTANCE OF EXCEL VISIBLE.
oXL.Visible = True
Set oWB = oXL.Workbooks.Open("c:\extrafiles\fantastic.xls")

End If
End Sub
 
R

Rick Rothstein

Open the picture where? In a worksheet? In a UserForm? In an Image control?
Somewhere else?
 
L

Launchnet via OfficeKB.com

Hi Rick
I just wanted the picture to be displayed (not in any program).
It is solved. Thanks for replying.
Matt @ Launchnet

Rick said:
Open the picture where? In a worksheet? In a UserForm? In an Image control?
Somewhere else?
I use the following macro to open excel files. Can this be modified to
open
[quoted text clipped - 38 lines]
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top