|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Nearly got it!!
Thanks again - I'm almost there but the compiler complains about the line:
ActiveSheet.Pictures.Insert(spath + sFilename).Select where spath = "o:\tristan\design_development\" and sfilename = "image1.jpg". I can get a picture to load if I just type the full pathname as a literal e.g. ActiveSheet.Pictures.Insert("o:\tristan\design_development\image1.jpg").Select. The error message is: Run Time Error 1004 Unable to get the Insert property of the Pictures class. I've managed to check what I'm storing in spath and sFilename by using MsgBox spath MsgBox sfilename and they look OK!! Is it something really stupid? Cheers |
|
#2
|
|||
|
|||
|
when concatinating two strings you should use & instead of +
__________________
Programmer's Corner |
|
#3
|
|||
|
|||
|
Hi there
Unfortunately, it is still bringing up the same error even when I change the + to a &. The whole code is: Dim i As Integer Dim sFilename As String Dim bcontinue As Boolean Dim spath As String Private Sub ShowImages_Click() spath = "O:\tristan\design_development\" i = 1 bcontinue = True While bcontinue sFilename = Worksheets(1).Cells(i, 1).Value 'get filename from cell e.g. image1.jpg If sFilename = "" Then bcontinue = False Else Cells(i, 2).Select ActiveSheet.Pictures.Insert(spath & sFilename).Select Selection.ShapeRange.LockAspectRatio = msoFalse Selection.ShapeRange.Height = 141.75 Selection.ShapeRange.Width = 141.75 i = i + 1 End If Wend End Sub Any thoughts would be most appreciated. Cheers tristyboy |
|
#4
|
||||
|
||||
|
I tried your code and it basically worked as it. The only thing I changed was a change to the path to a relevent image directory.
Are you sure that the path you are giving is correct? Also, your subject title in unacceptable. You can refer to the sticky at the top of this forum for more information on how to post a question. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Nearly got it!! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|