Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old August 5th, 2003, 09:21 AM
tristyboy tristyboy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Scotland
Posts: 7 tristyboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old August 5th, 2003, 10:40 AM
nopoints nopoints is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Windsor ON, Canada
Posts: 459 nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 13 h 44 m 22 sec
Reputation Power: 8
when concatinating two strings you should use & instead of +
__________________
Programmer's Corner

Reply With Quote
  #3  
Old August 6th, 2003, 03:05 AM
tristyboy tristyboy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Scotland
Posts: 7 tristyboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy & still doesn't seem to work

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

Reply With Quote
  #4  
Old August 6th, 2003, 07:46 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,834 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 23 h 30 m 30 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Nearly got it!!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway