LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Variable from Userform to Macro

Dear all,
Currently I have made a macro. the text of the code is as follows:

Sub ExcelChart2Word()
Dim lm As Single
Dim tm As Single
Dim w As Single
Dim h As Single

w = Application.InputBox("What should be the Width of Word chart?", , ,
, , , , 1)
h = Application.InputBox("What should be the Height of Word chart?", ,
, , , , , 1)

If w <= 0 Or h <= 0 Then
MsgBox ("Action cancelled")
Exit Sub
Else
End If
lm = (11 - w) / 2
tm = (8.5 - h) / 2
ActiveChart.Location Whe=xlLocationAsNewSheet
ActiveChart.ChartArea.Select
ActiveChart.ChartArea.AutoScaleFont = False
With ActiveChart.PageSetup
.LeftMargin = Application.InchesToPoints(lm)
.RightMargin = Application.InchesToPoints(lm)
.TopMargin = Application.InchesToPoints(tm)
.BottomMargin = Application.InchesToPoints(tm)

End With

My query is that can someone help me with a code whereby instead of 2
inputboxes, I can ask the user to input the data on onego e.g. a single
userform. I have never used a userform before. Any help would be
appreciated.

Thanks in advance.
Vikesh Jain

 
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
Userform and variable Jeff Excel Discussion (Misc queries) 1 March 16th 07 03:14 PM
VBA Variable as userform [email protected] Excel Programming 3 April 13th 06 08:32 PM
Variable ComboBox on Userform DHallam Excel Programming 2 July 19th 05 12:20 PM
userform variable as global crew3407[_6_] Excel Programming 8 May 6th 04 04:38 PM
Passing a value to a variable from Userform Neal Steiner Excel Programming 1 July 18th 03 09:12 PM


All times are GMT +1. The time now is 12:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"