Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting unnecessary 2nd Page
I found the following code by Tom Oglivy on Google and have applied into my
app. Just ran it for the first time and it is GREAT, except a second page is being produced with just a reminent (the width of the top-right "X" box (displayed) down my page 2 ) about 1/8th of an inch wide and 6 inches tall. How can I eliminate this residue so that only one page <<Page 1 is Perfect as is It's just that the last 1/8th inch of my Page 1 is repeating onto Page 2. 'In a General Module enter: Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _ ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Public Const VK_SNAPSHOT = 44 Public Const VK_LMENU = 164 Public Const KEYEVENTF_KEYUP = 2 Public Const KEYEVENTF_EXTENDEDKEY = 1 In the userform module: Private Sub CommandButton1_Click() ' keybd_event VK_SNAPSHOT, 0, 0, 0 DoEvents keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY, 0 keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY, 0 keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY + _ KEYEVENTF_KEYUP, 0 keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY + _ KEYEVENTF_KEYUP, 0 DoEvents Workbooks.Add Application.Wait Now + TimeValue("00:00:01") ActiveSheet.PasteSpecial Format:="Bitmap", Link:=False, DisplayAsIcon:=False ActiveSheet.Range("A1").Select ActiveWindow.SelectedSheets.PrintOut Copies:=1 ActiveWorkbook.Close False End Sub Thanks in advance for any assistance... Jim May |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting unnecessary 2nd Page
Maybe...
right after: ActiveSheet.Range("A1").Select add this: With ActiveSheet.PageSetup .Zoom = False .FitToPagesWide = 1 .FitToPagesTall = 1 End With (Untested) Jim May wrote: I found the following code by Tom Oglivy on Google and have applied into my app. Just ran it for the first time and it is GREAT, except a second page is being produced with just a reminent (the width of the top-right "X" box (displayed) down my page 2 ) about 1/8th of an inch wide and 6 inches tall. How can I eliminate this residue so that only one page <<Page 1 is Perfect as is It's just that the last 1/8th inch of my Page 1 is repeating onto Page 2. 'In a General Module enter: Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _ ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Public Const VK_SNAPSHOT = 44 Public Const VK_LMENU = 164 Public Const KEYEVENTF_KEYUP = 2 Public Const KEYEVENTF_EXTENDEDKEY = 1 In the userform module: Private Sub CommandButton1_Click() ' keybd_event VK_SNAPSHOT, 0, 0, 0 DoEvents keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY, 0 keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY, 0 keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY + _ KEYEVENTF_KEYUP, 0 keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY + _ KEYEVENTF_KEYUP, 0 DoEvents Workbooks.Add Application.Wait Now + TimeValue("00:00:01") ActiveSheet.PasteSpecial Format:="Bitmap", Link:=False, DisplayAsIcon:=False ActiveSheet.Range("A1").Select ActiveWindow.SelectedSheets.PrintOut Copies:=1 ActiveWorkbook.Close False End Sub Thanks in advance for any assistance... Jim May -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting unnecessary 2nd Page
Dave - That was it !! Much appreciated..
another quicky.. has befallen me.. Sometimes (& now is one of those times) in my Code sheet - my cursor instead of showing the cross-hair symbol - it becomes a black square the size of a character. I usually look around to see if I have mistakenlt touched a key, like the scroll-lock, whatever, but no joy.. Is there someting that this usualy points to that I can fix? Thanks, Jim May "Dave Peterson" wrote: Maybe... right after: ActiveSheet.Range("A1").Select add this: With ActiveSheet.PageSetup .Zoom = False .FitToPagesWide = 1 .FitToPagesTall = 1 End With (Untested) Jim May wrote: I found the following code by Tom Oglivy on Google and have applied into my app. Just ran it for the first time and it is GREAT, except a second page is being produced with just a reminent (the width of the top-right "X" box (displayed) down my page 2 ) about 1/8th of an inch wide and 6 inches tall. How can I eliminate this residue so that only one page <<Page 1 is Perfect as is It's just that the last 1/8th inch of my Page 1 is repeating onto Page 2. 'In a General Module enter: Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _ ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Public Const VK_SNAPSHOT = 44 Public Const VK_LMENU = 164 Public Const KEYEVENTF_KEYUP = 2 Public Const KEYEVENTF_EXTENDEDKEY = 1 In the userform module: Private Sub CommandButton1_Click() ' keybd_event VK_SNAPSHOT, 0, 0, 0 DoEvents keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY, 0 keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY, 0 keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY + _ KEYEVENTF_KEYUP, 0 keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY + _ KEYEVENTF_KEYUP, 0 DoEvents Workbooks.Add Application.Wait Now + TimeValue("00:00:01") ActiveSheet.PasteSpecial Format:="Bitmap", Link:=False, DisplayAsIcon:=False ActiveSheet.Range("A1").Select ActiveWindow.SelectedSheets.PrintOut Copies:=1 ActiveWorkbook.Close False End Sub Thanks in advance for any assistance... Jim May -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Getting unnecessary 2nd Page
Never mind - it is the INSERT key --- grrrr
"Dave Peterson" wrote: Maybe... right after: ActiveSheet.Range("A1").Select add this: With ActiveSheet.PageSetup .Zoom = False .FitToPagesWide = 1 .FitToPagesTall = 1 End With (Untested) Jim May wrote: I found the following code by Tom Oglivy on Google and have applied into my app. Just ran it for the first time and it is GREAT, except a second page is being produced with just a reminent (the width of the top-right "X" box (displayed) down my page 2 ) about 1/8th of an inch wide and 6 inches tall. How can I eliminate this residue so that only one page <<Page 1 is Perfect as is It's just that the last 1/8th inch of my Page 1 is repeating onto Page 2. 'In a General Module enter: Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _ ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Public Const VK_SNAPSHOT = 44 Public Const VK_LMENU = 164 Public Const KEYEVENTF_KEYUP = 2 Public Const KEYEVENTF_EXTENDEDKEY = 1 In the userform module: Private Sub CommandButton1_Click() ' keybd_event VK_SNAPSHOT, 0, 0, 0 DoEvents keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY, 0 keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY, 0 keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY + _ KEYEVENTF_KEYUP, 0 keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY + _ KEYEVENTF_KEYUP, 0 DoEvents Workbooks.Add Application.Wait Now + TimeValue("00:00:01") ActiveSheet.PasteSpecial Format:="Bitmap", Link:=False, DisplayAsIcon:=False ActiveSheet.Range("A1").Select ActiveWindow.SelectedSheets.PrintOut Copies:=1 ActiveWorkbook.Close False End Sub Thanks in advance for any assistance... Jim May -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Unnecessary Space | Excel Worksheet Functions | |||
Delete Unnecessary Rows | Excel Discussion (Misc queries) | |||
Unnecessary conversion | Excel Discussion (Misc queries) | |||
How do I remove unnecessary vertical page break? | Excel Worksheet Functions | |||
Using an XLT file which prints unnecessary 2nd page | New Users to Excel |