Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all
I want a sample code that inserts images in an exce sheet using VB, and also scales these images to a constant size. Thanks for help Regards Riya |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
'MS Excel object variables
Dim objExcel As Excel.Application Dim objWorkBook As Excel.Workbook Dim objWorkSheet As Excel.Worksheet Set objExcel = GetObject ("", "excel.application") ' Start the excel COM Set objWorkBook = objExcel.Workbooks.Add ' Start a workbook. objExcel.DisplayAlerts = False ' Turn off the alerts Do While objWorkBook.Worksheets.Count 1 ' keeps only one worksheet in the workbook Set objWorkSheet = objWorkBook.Worksheets.Item (objWorkBook.Worksheets.Count) objWorkSheet.Delete Loop Set objWorkSheet = objExcel.ActiveSheet ' Set objWorksheet to the remaining worksheet. objExcel.Visible = True objWorkSheet.Pictures.Insert ("C:\Pic1.Jpg") ' Insert a picture 'scale picture objWorkSheet.Pictures("Picture 1").Width = 200 objWorkSheet.Pictures("Picture 1").Height = 200 objWorkSheet.Pictures("Picture 1").Top = 200 objWorkSheet.Pictures("Picture 1").Left = 100 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
'Hope this is what you want
'MS Excel object variables Dim objExcel As Excel.Application Dim objWorkBook As Excel.Workbook Dim objWorkSheet As Excel.Worksheet Set objExcel = GetObject ("", "excel.application") ' Start the excel COM Set objWorkBook = objExcel.Workbooks.Add ' Start a workbook. objExcel.DisplayAlerts = False ' Turn off the alerts Do While objWorkBook.Worksheets.Count 1 ' keeps only one worksheet in the workbook Set objWorkSheet = objWorkBook.Worksheets.Item (objWorkBook.Worksheets.Count) objWorkSheet.Delete Loop Set objWorkSheet = objExcel.ActiveSheet ' Set objWorksheet to the remaining worksheet. objExcel.Visible = True objWorkSheet.Pictures.Insert ("C:\Pic1.Jpg") ' Insert a picture 'scale picture objWorkSheet.Pictures("Picture 1").Width = 200 objWorkSheet.Pictures("Picture 1").Height = 200 objWorkSheet.Pictures("Picture 1").Top = 200 objWorkSheet.Pictures("Picture 1").Left = 100 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Is there a way to insert images into unlocked cells | Excel Discussion (Misc queries) | |||
Insert Images Using Conditional Format (Many) | Excel Discussion (Misc queries) | |||
insert images in a protected worksheet | Excel Worksheet Functions | |||
I want glitter images to insert | New Users to Excel | |||
How do I insert/update VBA code into a sheet? (using a CLS file?) | Excel Programming |