Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Insert from paint and resize

Group: microsoft.public.excel.programming
https://groups.google.com/forum/#!to...ng/UqUQQ0Qokpg
Subject: insert from paint & resize

Hi

I hope someone can help with this. I use the code below which launches MS Paint, the user then signs within Paint (using the Touchpad on a laptop) the macro then closes Paint and the signature is placed in cell B39.

BUT . . . whatever I've tried it is never sized correctly - the graphic is usually too deep (the height of it is too high, so it's deeper than row 39 and 40). I've tried using the "Height" and "Width" options (and the top & left options) but they place the object in cell A1. The Sendkeys lines in the code work OK to get the box in and at a decent size but always

I've also tried using vba to adjust the row heights before and after the object is inserted and it's still not quite right.

So near and yet, so far . . . basically I have the code to get the signature in, what I need is some code to select the inserted object and resize it - or any alternative anyone can think of to achieve a signature from Paint in that cell.

any help greatly appreciated!

Steve




Range("B39").Select

Set SigPic = ActiveSheet.OLEObjects.Add(ClassType:="Paint.Pictu re", Link:=False, DisplayAsIcon:=False).Activate
SendKeys "%f"
SendKeys "%e"
SendKeys "%i"
SendKeys "%w"
SendKeys "4.25"
SendKeys "{TAB}"
SendKeys "1"
SendKeys "{Enter}"
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Insert from paint and resize

Hi Claus

thanks for this fast response. The Paint object doesn't seem to be picking up the SigPic name . . . once it's inserted, if I select it, it's named "Object1" (and of course the number increments for each new Paint object I insert).

Perhaps the line of code that inserts the Paint object needs modifying, but I can't see where or how, it looks pretty good to me !!??

Set SigPic = ActiveSheet.OLEObjects.Add(ClassType:="Paint.Pictu re", Link:=False, DisplayAsIcon:=False).Activate


Cheers!

Steve



On Thursday, 25 February 2016 13:22:44 UTC, Claus Busch wrote:
Hi Steven,

Am Thu, 25 Feb 2016 04:38:13 -0800 (PST) schrieb :

So near and yet, so far . . . basically I have the code to get the signature in, what I need is some code to select the inserted object and resize it - or any alternative anyone can think of to achieve a signature from Paint in that cell.


try after inserting the


pictu

With SigPic
.Top = Range("B39").Top
.Height = Range("B39").Height
.Left = Range("B39").Left
.Width = Range("B39").Width
End With


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Insert from paint and resize

Hi

That worked perfectly, the signature was placed exactly as I need it, BUT, I need the user to be able to collect a signature from a customer, so it won't be an existing file, so the launching paint option is still required. What I'm saying is, I want the user to click a button which launches our macro, the customer signs within MSPaint, when MSPaint is closed the signature ends up perfectly places, as per the last piece of code.

Thanks again.

Steve


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Insert from paint and resize

Hi Claus

I see. Do you think it'll be possible with the import pictures from Paint?

Steve
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Insert from paint and resize

Claus that looks great! I'm gonna try it tomorrow as I'm going out for the evening. Have a terrific evening yourself.

Steve
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Insert from paint and resize

Hi Claus

I think I've finally got this doing what we want with the code below. I've also had to move the signature to row 40.

This whole issue was seriously frustrating, as I sent a working version to my user last night and it didn't work on his laptop; this morning I adapted with your code and it STILL didn't work for him. We sent it to several other users and it was fine on their computers, so an anomaly on his laptop!!

Anyway, I believe and hope this is now concluded, so a HUGE "Thank You" to yourself for your knowledge, assistance and patience.

Steve


Sub aSignature1()
Dim shp As Shape
Range("B40").Select
On Error Resume Next

Set SigPic = ActiveSheet.OLEObjects.Add(ClassType:="Paint.Pictu re", Link:=False, DisplayAsIcon:=False).Activate
Application.Wait Now + TimeValue("00:00:01")
SendKeys "%f"
SendKeys "%e"
SendKeys "%i"
SendKeys "%w"
SendKeys "4.25"
SendKeys "{TAB}"
SendKeys "1"
SendKeys "{Enter}"

With ActiveSheet
Set shp = .Shapes(.Shapes.Count)
End With

With Range("B40")
shp.Top = .Top - 10
shp.Left = .Left
shp.Width = .ColumnWidth * 2
shp.Height = .RowHeight * 0.75
End With
End Sub
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
insert from paint & resize [email protected] Excel Programming 0 February 25th 16 12:35 PM
Insert image from paint Ryan H Excel Programming 2 October 16th 09 07:38 PM
How do I insert and resize a column on only one worksheet page? gottaknow Excel Discussion (Misc queries) 4 September 30th 09 11:46 AM
Insert, position, and resize a picture w/ Macro John Excel Discussion (Misc queries) 1 July 10th 07 07:21 PM
auto resize when insert large image to excel sajid Excel Worksheet Functions 4 November 21st 06 03:40 PM


All times are GMT +1. The time now is 10:25 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"