Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to know the picture is open

I am using MS Office 2003 and writing VBA in Excel.

I have a picture which is not inserted in Excel and saves in a folder. I
want to know if the picture is opening or not. Because I have to make sure
the picture is not opening before renaming it.

Do you have any solution to know if the picture is opening?
Appreciate for your kind post.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default how to know the picture is open

Microsoft has an IsFileOpen function at:
http://support.microsoft.com?kbid=138621

But when I opened some .jpg's in various programs (irfanview, paint, imaging),
the file showed not in use. I could even delete it.

Could you try to just rename it and then check to see if it was successful:

Option Explicit
Sub testme()

Dim MyOldFileName As String
Dim myNewFileName As String

MyOldFileName = "c:\my documents\my pictures\keyboard2.jpg"
myNewFileName = "c:\my documents\my pictures\keyboard.jpg"

If Dir(MyOldFileName) = "" Then
MsgBox "It's not there!"
Else
On Error Resume Next
Name MyOldFileName As myNewFileName
If Err.Number < 0 Then
MsgBox "Rename failed, it may be in use elsewhere"
Err.Clear
End If
End If

End Sub

Dorothy Lo wrote:

I am using MS Office 2003 and writing VBA in Excel.

I have a picture which is not inserted in Excel and saves in a folder. I
want to know if the picture is opening or not. Because I have to make sure
the picture is not opening before renaming it.

Do you have any solution to know if the picture is opening?
Appreciate for your kind post.


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
hyperlink no picture "No program is regitered to open this file" Paul Setting up and Configuration of Excel 0 August 12th 08 04:49 AM
all my shortcuts to excel files open up as a picture Gimbee Excel Discussion (Misc queries) 0 April 13th 08 12:39 AM
Need to open a picture with a link RD Excel Worksheet Functions 2 February 29th 08 03:30 PM
Can't open picture file link in Excel, Error no program registere. Habanero Mike Excel Discussion (Misc queries) 1 September 3rd 07 07:16 PM
open gif with picture and fax viewer from Excel Mjski Excel Discussion (Misc queries) 0 February 23rd 05 11:53 PM


All times are GMT +1. The time now is 07:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"