ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert Picture to Excel to specified range (https://www.excelbanter.com/excel-programming/279101-insert-picture-excel-specified-range.html)

Budiono[_2_]

Insert Picture to Excel to specified range
 
i want to insert picture from disk to excel using visual basic 6. i've use
following code:

dim oApp As New Excel.Application
dim oWkbk As Excel.Workbook
dim oSheet As Excel.Worksheet

ActiveCell.Range("A100").Activate
ActiveSheet.Pictures.Insert ("C:\TEMP.BMP")

the problem is, the picture is to large and i want to insert that picture
only from cell A100 to E120.
which function i should use?

any help would be greatly appreciate..
thanks



keepITcool

Insert Picture to Excel to specified range
 

Sub Linked()
Dim s As Shape
With [b5]
Set s = .Parent.Shapes.AddPicture("D:\Documents\!Pictures\ marg_v1.png",
True, True, .Left, .Top, .Width, .Height)
End With
With s
.ScaleHeight 0.5, msoTrue
.ScaleWidth 0.5, msoTrue
End With
End Sub

demo shows insertion with cell's size then scales to 50% of original
(saved) size

look in VBA help for meaning of arguments.

cheerz!


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Budiono" wrote:

i want to insert picture from disk to excel using visual basic 6. i've
use following code:

dim oApp As New Excel.Application
dim oWkbk As Excel.Workbook
dim oSheet As Excel.Worksheet

ActiveCell.Range("A100").Activate
ActiveSheet.Pictures.Insert ("C:\TEMP.BMP")

the problem is, the picture is to large and i want to insert that
picture only from cell A100 to E120.
which function i should use?

any help would be greatly appreciate..
thanks





Budiono[_2_]

Insert Picture to Excel to specified range
 
i've try ur code but it doesn't work :(
what do you mean with '[b5]' ?

"keepitcool" wrote in message
...

Sub Linked()
Dim s As Shape
With [b5]
Set s = .Parent.Shapes.AddPicture("D:\Documents\!Pictures\ marg_v1.png",
True, True, .Left, .Top, .Width, .Height)
End With
With s
.ScaleHeight 0.5, msoTrue
.ScaleWidth 0.5, msoTrue
End With
End Sub

demo shows insertion with cell's size then scales to 50% of original
(saved) size

look in VBA help for meaning of arguments.

cheerz!


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Budiono" wrote:

i want to insert picture from disk to excel using visual basic 6. i've
use following code:

dim oApp As New Excel.Application
dim oWkbk As Excel.Workbook
dim oSheet As Excel.Worksheet

ActiveCell.Range("A100").Activate
ActiveSheet.Pictures.Insert ("C:\TEMP.BMP")

the problem is, the picture is to large and i want to insert that
picture only from cell A100 to E120.
which function i should use?

any help would be greatly appreciate..
thanks







keepITcool

Insert Picture to Excel to specified range
 
[b5] is short code for range("b5") on the activesheet
[sheet3!b5)=worksheets("sheet3").range("b5")

it probably doesnt work due to linebreaks or file not found.
for me the principle works in xl97 & xlxp


adjusted it would look like:

Sub Linked()
Dim s As Shape
With [a100]
Set s = .Parent.Shapes.AddPicture( _
"C:\TEMP.BMP", _
True, True, .Left, .Top, .Width, .Height)
End With
With s
.ScaleHeight 0.5, msoTrue
.ScaleWidth 0.5, msoTrue
End With
End Sub


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Budiono" wrote:

i've try ur code but it doesn't work :(
what do you mean with '[b5]' ?

"keepitcool" wrote in message
...

Sub Linked()
Dim s As Shape
With [b5]
Set s = .Parent.Shapes.AddPicture("D:\Documents\!Pictures

\marg_v1.png",
True, True, .Left, .Top, .Width, .Height)
End With
With s
.ScaleHeight 0.5, msoTrue
.ScaleWidth 0.5, msoTrue
End With
End Sub

demo shows insertion with cell's size then scales to 50% of original
(saved) size

look in VBA help for meaning of arguments.

cheerz!


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Budiono" wrote:

i want to insert picture from disk to excel using visual basic 6.

i've
use following code:

dim oApp As New Excel.Application
dim oWkbk As Excel.Workbook
dim oSheet As Excel.Worksheet

ActiveCell.Range("A100").Activate
ActiveSheet.Pictures.Insert ("C:\TEMP.BMP")

the problem is, the picture is to large and i want to insert that
picture only from cell A100 to E120.
which function i should use?

any help would be greatly appreciate..
thanks









Budiono[_2_]

Insert Picture to Excel to specified range
 
thanks for your replay, but i still have diffilculties.
do you mean that sub procedure as a macro that i've to save it to .bas file?
i've save it to .bas file and then do the following code:

oWkbk.VBE.ActiveVBProject.VBComponents.Import "C:\picsize.bas" 'i've save
your code to file picsize.bas
oWkbk.Run "picsize", oSheet

but it doesn't work :(
where i can file for VBA help files?
thanks :)


"keepitcool" wrote in message
...
[b5] is short code for range("b5") on the activesheet
[sheet3!b5)=worksheets("sheet3").range("b5")

it probably doesnt work due to linebreaks or file not found.
for me the principle works in xl97 & xlxp


adjusted it would look like:

Sub Linked()
Dim s As Shape
With [a100]
Set s = .Parent.Shapes.AddPicture( _
"C:\TEMP.BMP", _
True, True, .Left, .Top, .Width, .Height)
End With
With s
.ScaleHeight 0.5, msoTrue
.ScaleWidth 0.5, msoTrue
End With
End Sub





Budiono[_2_]

Insert Picture to Excel to specified range
 
i've tried again n it's work. thanks :)

"keepitcool" wrote in message
...
[b5] is short code for range("b5") on the activesheet
[sheet3!b5)=worksheets("sheet3").range("b5")

it probably doesnt work due to linebreaks or file not found.
for me the principle works in xl97 & xlxp


adjusted it would look like:

Sub Linked()
Dim s As Shape
With [a100]
Set s = .Parent.Shapes.AddPicture( _
"C:\TEMP.BMP", _
True, True, .Left, .Top, .Width, .Height)
End With
With s
.ScaleHeight 0.5, msoTrue
.ScaleWidth 0.5, msoTrue
End With
End Sub


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Budiono" wrote:

i've try ur code but it doesn't work :(
what do you mean with '[b5]' ?

"keepitcool" wrote in message
...

Sub Linked()
Dim s As Shape
With [b5]
Set s = .Parent.Shapes.AddPicture("D:\Documents\!Pictures

\marg_v1.png",
True, True, .Left, .Top, .Width, .Height)
End With
With s
.ScaleHeight 0.5, msoTrue
.ScaleWidth 0.5, msoTrue
End With
End Sub

demo shows insertion with cell's size then scales to 50% of original
(saved) size

look in VBA help for meaning of arguments.

cheerz!


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Budiono" wrote:

i want to insert picture from disk to excel using visual basic 6.

i've
use following code:

dim oApp As New Excel.Application
dim oWkbk As Excel.Workbook
dim oSheet As Excel.Worksheet

ActiveCell.Range("A100").Activate
ActiveSheet.Pictures.Insert ("C:\TEMP.BMP")

the problem is, the picture is to large and i want to insert that
picture only from cell A100 to E120.
which function i should use?

any help would be greatly appreciate..
thanks












All times are GMT +1. The time now is 01:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com