Results 1 to 12 of 12

How to open .jpg picture with macro

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    09-04-2007
    Location
    Ontario, Ca
    Posts
    624

    How to open .jpg picture with macro

    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 the picture is already open and if not, that it actually exists.


    Please see bottom of this posting for additional question!

    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
    P.S. - - - I am still looking for a way to activate the workbook we're looking for when the above test states that it is already open.
    Last edited by Launchnet; 02-24-2009 at 02:02 AM.
    Thanks for helping . . .
    Matt @ Launchnet

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1