Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 177
Default problems with importing an image

we have an intranet page that links up with Excel. it passes a whole bunch of
info using fields and then Excel displays it all. The intranet has its own
server.

If I'm using a workstation everything runs fine, however, if I'm working on
our main server the image does not load properly.

Now the details.....

the field that gets passed to Excel has a value like this: "\\ipaddress of
intranet server\folder\file.gif"

when excel opens the following script runs:


Private Sub Workbook_Open()
Dim myPict As Picture
Dim curWks As Worksheet
Dim myRng As Range
Dim myCell As Range
Dim myPictName As Variant



Set curWks = Sheets(1) ' Change to suit

'curWks.Pictures.Delete

With curWks
Set myRng = .Range("B57")
End With


If Trim(myRng.Cells.Value) = "" Then
'do nothing
ElseIf Dir(CStr(myRng.Cells.Value)) = "" Then
'picture not there!
'MsgBox myRng.Cells.Value & " Doesn't exist!"
Else
With myRng.Cells.Offset(0, 1) '3 columns to the right of C (F)
Set myPict = myRng.Cells.Parent.Pictures.Insert(myRng.Cells.Val ue)
myPict.Top = .Top
myPict.Width = .Width
myPict.Height = .Height
myPict.Left = .Left
myPict.Placement = xlMoveAndSize
End With
End If



End Sub


The script will break at this point:

ElseIf Dir(CStr(myRng.Cells.Value)) = "" Then
'picture not there!
'MsgBox myRng.Cells.Value & " Doesn't exist!"



The value of the field gets inserted into a specific cell and displays as a
link - visually theres nothing wrong with that data or the link, however, if
you try it you get a message that says it cant find the server.

After playing around with that link (trying different ways to write it - but
with no success) I changed it back to the original way it was and it all of a
sudden it worked (sort of) for one specific instance. By "sort of" I mean
that I still got an error from the script telling me it couldnt find the
image and if i clicked on the link it threw the "couldnt find the server"
error - even though the image was right there on the page. Add to the fact
that I had just changed it back to the original way it was written so, in
reality, I didnt change anything at all - and i couldnt repeat the miracle
either.

Again, I can go to any workstation and get this procedure to run fine but
only when I try and do this on our main server does it give me problems. both
the workstations and the server run Excel 2003. The workstations run IE7 and
the server still runs IE6. XP for the worksations and 2003 for the server.

I've tried to explain this as best i could with out getting too long winded
about the whole thing. If I've left anything out I apologize and would be
happy to provide more info.

Thank you very much

TB
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
importing a scanned image Julie Excel Discussion (Misc queries) 4 August 24th 07 05:00 PM
I can't delete an image in excel workbook [email protected] Excel Discussion (Misc queries) 6 October 13th 06 06:41 PM
Problems importing from an Access query Mike Excel Discussion (Misc queries) 0 June 20th 06 09:35 PM
Formatting datetime problems importing data from mysql db PEA Excel Discussion (Misc queries) 2 February 23rd 06 11:04 PM
Problems Importing from Access davey Excel Discussion (Misc queries) 1 July 8th 05 05:47 PM


All times are GMT +1. The time now is 09:16 AM.

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"