Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Insert Image in an sheet

I am trying to add image based on the parameters. but it gives me error

automation error / unspecified error

-2147467259(80004005)

following is my code (tring to run hardcoded image file)

Sub Addimage()
Sheet1.Image1.Picture = Nothing
Sheet1.Image1.Picture = LoadPicture("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

Request Pls help ASAP

Thankyou



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Insert Image in an sheet

Maybe...

Sheet1.OLEObjects("Image1").Object.Picture _
= LoadPicture("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

Rupesh wrote:

I am trying to add image based on the parameters. but it gives me error

automation error / unspecified error

-2147467259(80004005)

following is my code (tring to run hardcoded image file)

Sub Addimage()
Sheet1.Image1.Picture = Nothing
Sheet1.Image1.Picture = LoadPicture("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

Request Pls help ASAP

Thankyou


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Insert Image in an sheet

what i see problem as when we type
sheet1.image1. (then automatically dropdown of the related properties is
not coming & there may be some problem

Pls help
Rupesh

"Rupesh" wrote:

I am trying to add image based on the parameters. but it gives me error

automation error / unspecified error

-2147467259(80004005)

following is my code (tring to run hardcoded image file)

Sub Addimage()
Sheet1.Image1.Picture = Nothing
Sheet1.Image1.Picture = LoadPicture("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

Request Pls help ASAP

Thankyou



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Insert Image in an sheet

One of your problems with your code is you are setting image1 to nothing when
they is no image. You can test if newpict below is set to nothing after the
insert instruction below.

Sub Addimage()

Set newpict = Sheets("Sheet1").Pictures.Insert _
("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

"Rupesh" wrote:

what i see problem as when we type
sheet1.image1. (then automatically dropdown of the related properties is
not coming & there may be some problem

Pls help
Rupesh

"Rupesh" wrote:

I am trying to add image based on the parameters. but it gives me error

automation error / unspecified error

-2147467259(80004005)

following is my code (tring to run hardcoded image file)

Sub Addimage()
Sheet1.Image1.Picture = Nothing
Sheet1.Image1.Picture = LoadPicture("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

Request Pls help ASAP

Thankyou



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Insert Image in an sheet

dear Joel
Thanks for reply.

However

image1 is already there as an =EMBED("Forms.Image.1","")

every time my macro resets its to nothing first & then adds an image based
on the user input.

I have used this earlier (may be on differnt machine) but today it gives me
an error

As i already mentioned auto dropdown when typing image1. is not coming
(may be that is creating problem )

thanks


"Joel" wrote:

One of your problems with your code is you are setting image1 to nothing when
they is no image. You can test if newpict below is set to nothing after the
insert instruction below.

Sub Addimage()

Set newpict = Sheets("Sheet1").Pictures.Insert _
("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

"Rupesh" wrote:

what i see problem as when we type
sheet1.image1. (then automatically dropdown of the related properties is
not coming & there may be some problem

Pls help
Rupesh

"Rupesh" wrote:

I am trying to add image based on the parameters. but it gives me error

automation error / unspecified error

-2147467259(80004005)

following is my code (tring to run hardcoded image file)

Sub Addimage()
Sheet1.Image1.Picture = Nothing
Sheet1.Image1.Picture = LoadPicture("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

Request Pls help ASAP

Thankyou





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Insert Image in an sheet

Drop that "Sheet1.Image1.Picture = Nothing" line.

Then use a variable to represent the image.

Dim myImage As Image
Set myImage = Sheet1.Image1
myImage. and you should see the intellisense helping you.

Rupesh wrote:

what i see problem as when we type
sheet1.image1. (then automatically dropdown of the related properties is
not coming & there may be some problem

Pls help
Rupesh

"Rupesh" wrote:

I am trying to add image based on the parameters. but it gives me error

automation error / unspecified error

-2147467259(80004005)

following is my code (tring to run hardcoded image file)

Sub Addimage()
Sheet1.Image1.Picture = Nothing
Sheet1.Image1.Picture = LoadPicture("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

Request Pls help ASAP

Thankyou




--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Insert Image in an sheet

You r picture may not be image one. to make sure you get rid of all pictures
no matter what they are called you can use the following

Sub delete_picture()

For Each pict In ActiveSheet.Shapes
If pict.Type = msoPicture Then
pict.Delete
End If
Next pict

End Sub

"Rupesh" wrote:

dear Joel
Thanks for reply.

However

image1 is already there as an =EMBED("Forms.Image.1","")

every time my macro resets its to nothing first & then adds an image based
on the user input.

I have used this earlier (may be on differnt machine) but today it gives me
an error

As i already mentioned auto dropdown when typing image1. is not coming
(may be that is creating problem )

thanks


"Joel" wrote:

One of your problems with your code is you are setting image1 to nothing when
they is no image. You can test if newpict below is set to nothing after the
insert instruction below.

Sub Addimage()

Set newpict = Sheets("Sheet1").Pictures.Insert _
("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

"Rupesh" wrote:

what i see problem as when we type
sheet1.image1. (then automatically dropdown of the related properties is
not coming & there may be some problem

Pls help
Rupesh

"Rupesh" wrote:

I am trying to add image based on the parameters. but it gives me error

automation error / unspecified error

-2147467259(80004005)

following is my code (tring to run hardcoded image file)

Sub Addimage()
Sheet1.Image1.Picture = Nothing
Sheet1.Image1.Picture = LoadPicture("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

Request Pls help ASAP

Thankyou



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Insert Image in an sheet

it worked fine for intellisense, but still facing same problem

myImage.Picture = LoadPicture("c:\rupesh\8022.JPG")

gives me automation error - unspecified error.

is it somthing to do with my Excel installation ? is somthing missing. I
have used this earlier also on different machine, long ago.

need to solve this ASAP

please help

"Dave Peterson" wrote:

Drop that "Sheet1.Image1.Picture = Nothing" line.

Then use a variable to represent the image.

Dim myImage As Image
Set myImage = Sheet1.Image1
myImage. and you should see the intellisense helping you.

Rupesh wrote:

what i see problem as when we type
sheet1.image1. (then automatically dropdown of the related properties is
not coming & there may be some problem

Pls help
Rupesh

"Rupesh" wrote:

I am trying to add image based on the parameters. but it gives me error

automation error / unspecified error

-2147467259(80004005)

following is my code (tring to run hardcoded image file)

Sub Addimage()
Sheet1.Image1.Picture = Nothing
Sheet1.Image1.Picture = LoadPicture("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

Request Pls help ASAP

Thankyou




--

Dave Peterson

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Insert Image in an sheet

I suspect yo don't have an image1 object in your worksheet any more. You may
of deleted the object or while you were debugging your problems created an
image2. You may need to add the picture as a new object

Set newpict = Sheets("Sheet1").Pictures.Insert _
("\\WIN2K3\IMAGES\8000\8029.JPG")

or

Set image1 = Sheets("Sheet1").Pictures.Insert _
("\\WIN2K3\IMAGES\8000\8029.JPG")

"Rupesh" wrote:

it worked fine for intellisense, but still facing same problem

myImage.Picture = LoadPicture("c:\rupesh\8022.JPG")

gives me automation error - unspecified error.

is it somthing to do with my Excel installation ? is somthing missing. I
have used this earlier also on different machine, long ago.

need to solve this ASAP

please help

"Dave Peterson" wrote:

Drop that "Sheet1.Image1.Picture = Nothing" line.

Then use a variable to represent the image.

Dim myImage As Image
Set myImage = Sheet1.Image1
myImage. and you should see the intellisense helping you.

Rupesh wrote:

what i see problem as when we type
sheet1.image1. (then automatically dropdown of the related properties is
not coming & there may be some problem

Pls help
Rupesh

"Rupesh" wrote:

I am trying to add image based on the parameters. but it gives me error

automation error / unspecified error

-2147467259(80004005)

following is my code (tring to run hardcoded image file)

Sub Addimage()
Sheet1.Image1.Picture = Nothing
Sheet1.Image1.Picture = LoadPicture("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

Request Pls help ASAP

Thankyou




--

Dave Peterson

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Insert Image in an sheet

Image1 object is there on the shee1 .i sent this file to one of my frien & it
worked without any error on his machine.

it is giving me problem here.



"Joel" wrote:

I suspect yo don't have an image1 object in your worksheet any more. You may
of deleted the object or while you were debugging your problems created an
image2. You may need to add the picture as a new object

Set newpict = Sheets("Sheet1").Pictures.Insert _
("\\WIN2K3\IMAGES\8000\8029.JPG")

or

Set image1 = Sheets("Sheet1").Pictures.Insert _
("\\WIN2K3\IMAGES\8000\8029.JPG")

"Rupesh" wrote:

it worked fine for intellisense, but still facing same problem

myImage.Picture = LoadPicture("c:\rupesh\8022.JPG")

gives me automation error - unspecified error.

is it somthing to do with my Excel installation ? is somthing missing. I
have used this earlier also on different machine, long ago.

need to solve this ASAP

please help

"Dave Peterson" wrote:

Drop that "Sheet1.Image1.Picture = Nothing" line.

Then use a variable to represent the image.

Dim myImage As Image
Set myImage = Sheet1.Image1
myImage. and you should see the intellisense helping you.

Rupesh wrote:

what i see problem as when we type
sheet1.image1. (then automatically dropdown of the related properties is
not coming & there may be some problem

Pls help
Rupesh

"Rupesh" wrote:

I am trying to add image based on the parameters. but it gives me error

automation error / unspecified error

-2147467259(80004005)

following is my code (tring to run hardcoded image file)

Sub Addimage()
Sheet1.Image1.Picture = Nothing
Sheet1.Image1.Picture = LoadPicture("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

Request Pls help ASAP

Thankyou




--

Dave Peterson



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Insert Image in an sheet

May be you don't have permission to read the file. try adding this code

FName = Dir ("\\WIN2K3\IMAGES\8000\8029.JPG")
if FName = "" then
msgbox("Cannot Find file")
exit sub
end if


"Rupesh" wrote:

Image1 object is there on the shee1 .i sent this file to one of my frien & it
worked without any error on his machine.

it is giving me problem here.



"Joel" wrote:

I suspect yo don't have an image1 object in your worksheet any more. You may
of deleted the object or while you were debugging your problems created an
image2. You may need to add the picture as a new object

Set newpict = Sheets("Sheet1").Pictures.Insert _
("\\WIN2K3\IMAGES\8000\8029.JPG")

or

Set image1 = Sheets("Sheet1").Pictures.Insert _
("\\WIN2K3\IMAGES\8000\8029.JPG")

"Rupesh" wrote:

it worked fine for intellisense, but still facing same problem

myImage.Picture = LoadPicture("c:\rupesh\8022.JPG")

gives me automation error - unspecified error.

is it somthing to do with my Excel installation ? is somthing missing. I
have used this earlier also on different machine, long ago.

need to solve this ASAP

please help

"Dave Peterson" wrote:

Drop that "Sheet1.Image1.Picture = Nothing" line.

Then use a variable to represent the image.

Dim myImage As Image
Set myImage = Sheet1.Image1
myImage. and you should see the intellisense helping you.

Rupesh wrote:

what i see problem as when we type
sheet1.image1. (then automatically dropdown of the related properties is
not coming & there may be some problem

Pls help
Rupesh

"Rupesh" wrote:

I am trying to add image based on the parameters. but it gives me error

automation error / unspecified error

-2147467259(80004005)

following is my code (tring to run hardcoded image file)

Sub Addimage()
Sheet1.Image1.Picture = Nothing
Sheet1.Image1.Picture = LoadPicture("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

Request Pls help ASAP

Thankyou




--

Dave Peterson

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Insert Image in an sheet

Instead of using image control i have now used

ActiveSheet.Pictures.Insert

and its working fine. only i need to adjust image size every time in proper
format.

Thanks a lot for all your help.


"Joel" wrote:

May be you don't have permission to read the file. try adding this code

FName = Dir ("\\WIN2K3\IMAGES\8000\8029.JPG")
if FName = "" then
msgbox("Cannot Find file")
exit sub
end if


"Rupesh" wrote:

Image1 object is there on the shee1 .i sent this file to one of my frien & it
worked without any error on his machine.

it is giving me problem here.



"Joel" wrote:

I suspect yo don't have an image1 object in your worksheet any more. You may
of deleted the object or while you were debugging your problems created an
image2. You may need to add the picture as a new object

Set newpict = Sheets("Sheet1").Pictures.Insert _
("\\WIN2K3\IMAGES\8000\8029.JPG")

or

Set image1 = Sheets("Sheet1").Pictures.Insert _
("\\WIN2K3\IMAGES\8000\8029.JPG")

"Rupesh" wrote:

it worked fine for intellisense, but still facing same problem

myImage.Picture = LoadPicture("c:\rupesh\8022.JPG")

gives me automation error - unspecified error.

is it somthing to do with my Excel installation ? is somthing missing. I
have used this earlier also on different machine, long ago.

need to solve this ASAP

please help

"Dave Peterson" wrote:

Drop that "Sheet1.Image1.Picture = Nothing" line.

Then use a variable to represent the image.

Dim myImage As Image
Set myImage = Sheet1.Image1
myImage. and you should see the intellisense helping you.

Rupesh wrote:

what i see problem as when we type
sheet1.image1. (then automatically dropdown of the related properties is
not coming & there may be some problem

Pls help
Rupesh

"Rupesh" wrote:

I am trying to add image based on the parameters. but it gives me error

automation error / unspecified error

-2147467259(80004005)

following is my code (tring to run hardcoded image file)

Sub Addimage()
Sheet1.Image1.Picture = Nothing
Sheet1.Image1.Picture = LoadPicture("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

Request Pls help ASAP

Thankyou




--

Dave Peterson

  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Insert Image in an sheet

I always set a variable to any object that I add so I can easily add
properties to the object and make the code easier to read. like

Set newpict = Sheets("Sheet1").Pictures.Insert _
("\\WIN2K3\IMAGES\8000\8029.JPG
newpict.left = 12
newpict.top = 5

"Rupesh" wrote:

Instead of using image control i have now used

ActiveSheet.Pictures.Insert

and its working fine. only i need to adjust image size every time in proper
format.

Thanks a lot for all your help.


"Joel" wrote:

May be you don't have permission to read the file. try adding this code

FName = Dir ("\\WIN2K3\IMAGES\8000\8029.JPG")
if FName = "" then
msgbox("Cannot Find file")
exit sub
end if


"Rupesh" wrote:

Image1 object is there on the shee1 .i sent this file to one of my frien & it
worked without any error on his machine.

it is giving me problem here.



"Joel" wrote:

I suspect yo don't have an image1 object in your worksheet any more. You may
of deleted the object or while you were debugging your problems created an
image2. You may need to add the picture as a new object

Set newpict = Sheets("Sheet1").Pictures.Insert _
("\\WIN2K3\IMAGES\8000\8029.JPG")

or

Set image1 = Sheets("Sheet1").Pictures.Insert _
("\\WIN2K3\IMAGES\8000\8029.JPG")

"Rupesh" wrote:

it worked fine for intellisense, but still facing same problem

myImage.Picture = LoadPicture("c:\rupesh\8022.JPG")

gives me automation error - unspecified error.

is it somthing to do with my Excel installation ? is somthing missing. I
have used this earlier also on different machine, long ago.

need to solve this ASAP

please help

"Dave Peterson" wrote:

Drop that "Sheet1.Image1.Picture = Nothing" line.

Then use a variable to represent the image.

Dim myImage As Image
Set myImage = Sheet1.Image1
myImage. and you should see the intellisense helping you.

Rupesh wrote:

what i see problem as when we type
sheet1.image1. (then automatically dropdown of the related properties is
not coming & there may be some problem

Pls help
Rupesh

"Rupesh" wrote:

I am trying to add image based on the parameters. but it gives me error

automation error / unspecified error

-2147467259(80004005)

following is my code (tring to run hardcoded image file)

Sub Addimage()
Sheet1.Image1.Picture = Nothing
Sheet1.Image1.Picture = LoadPicture("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

Request Pls help ASAP

Thankyou




--

Dave Peterson

  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Insert Image in an sheet

Did you try this suggestion:

Sheet1.OLEObjects("Image1").Object.Picture _
= LoadPicture("\\WIN2K3\IMAGES\8000\8029.JPG")



Rupesh wrote:

it worked fine for intellisense, but still facing same problem

myImage.Picture = LoadPicture("c:\rupesh\8022.JPG")

gives me automation error - unspecified error.

is it somthing to do with my Excel installation ? is somthing missing. I
have used this earlier also on different machine, long ago.

need to solve this ASAP

please help

"Dave Peterson" wrote:

Drop that "Sheet1.Image1.Picture = Nothing" line.

Then use a variable to represent the image.

Dim myImage As Image
Set myImage = Sheet1.Image1
myImage. and you should see the intellisense helping you.

Rupesh wrote:

what i see problem as when we type
sheet1.image1. (then automatically dropdown of the related properties is
not coming & there may be some problem

Pls help
Rupesh

"Rupesh" wrote:

I am trying to add image based on the parameters. but it gives me error

automation error / unspecified error

-2147467259(80004005)

following is my code (tring to run hardcoded image file)

Sub Addimage()
Sheet1.Image1.Picture = Nothing
Sheet1.Image1.Picture = LoadPicture("\\WIN2K3\IMAGES\8000\8029.JPG")

End Sub

Request Pls help ASAP

Thankyou




--

Dave Peterson


--

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
Insert image, get name of image Rick S. Excel Programming 3 April 15th 08 07:05 PM
Insert image from Cell value Corey Excel Programming 0 August 13th 07 12:26 AM
insert image vj5 Excel Programming 10 July 14th 06 02:11 PM
automatically insert each image to its own sheet jwewing23 Excel Programming 0 March 16th 05 08:41 PM
How can i insert image in excel sheet (SYLK) format hYoussef Excel Programming 1 February 28th 05 05:00 AM


All times are GMT +1. The time now is 04:32 PM.

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

About Us

"It's about Microsoft Excel"