Word Vba Input Box to set Document Orientation - IF with OR -


in macro want prompt page orientation -- p or p portrait, l or l landscape.

here developed. works - want know if there better/more efficient way develop if statements "or" --- have use "nested" if??

    dim integer     dim otbl table     dim rng range     dim orientation string    selection.pagesetup         .linenumbering.active = false         .orientation = wdorientportrait         .topmargin = inchestopoints(1)         .bottommargin = inchestopoints(1)         .leftmargin = inchestopoints(0.4)         .rightmargin = inchestopoints(0.4)         .gutter = inchestopoints(0)         .headerdistance = inchestopoints(0.5)         .footerdistance = inchestopoints(0.6)         .pagewidth = inchestopoints(8.5)         .pageheight = inchestopoints(11)         .firstpagetray = wdprinterdefaultbin         .otherpagestray = wdprinterdefaultbin         .sectionstart = wdsectionnewpage         .oddandevenpagesheaderfooter = false         .differentfirstpageheaderfooter = false         .verticalalignment = wdalignverticaltop         .suppressendnotes = false         .mirrormargins = false         .twopagesonone = false         .bookfoldprinting = false         .bookfoldrevprinting = false         .bookfoldprintingsheets = 1         .gutterpos = wdgutterposleft     end   ' set orientation       orientation = inputbox(prompt:="enter p portriait, l landscape")      if orientation = "l"         selection.pagesetup               .orientation = wdorientlandscape         end     elseif orientation = "l"         selection.pagesetup               .orientation = wdorientlandscape         end     else         selection.pagesetup               .orientation = wdorientportrait         end     end if 

i'm not sure there better (more efficient) way develop ms word page orientation... not use inputbox, if want use i'd this:

askagain:     orientation = inputbox(prompt:="enter p portriait, l landscape")      select case ucase(orientation)           case "l"             selection.pagesetup.orientation = wdorientlandscape          case "p"             selection.pagesetup.orientation = wdorientportrait          case else             goto askagain     end select 

to honest... leave decision user , not prevent user set page orientation vba code, call print preview window. best way - in opinion.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -