this one stops too

shackbully

New Member
Joined
Oct 24, 2004
Messages
7
it will open the file, but then it will stop, it will step through fine. all i want it to do is open this file, print it, then close the file. it sounds so simple.
i'm thinking of getting a large wrench from the shop. i'm just not getting the hang of visual basic, any suggested reading or training?
thanks
lucien


' Keyboard Shortcut: Ctrl+Shift+I
'
Workbooks.Open Filename:="C:\p2_daily\Forms\logshets\p2_2hrlogsheet.xls"
Range("A1:DX40").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$DX$40"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveWindow.Close SaveChanges = False
End Sub
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Does this work?
Code:
Set wb = Workbooks.Open (Filename:="C:\p2_daily\Forms\logshets\p2_2hrlogsheet.xls")

wb.ActiveSheet.Range("$A$1:$DX$40").PrintOut Copies:=1, Collate:=True 
wb.Close SaveChanges = False
 
Upvote 0
Lucien

When you say 'stops', what do you actually mean?
 
Upvote 0
the file p2_2hrlogsheet will open, curser at A1 with the file active, won't print or close. it's like all the macro was asked to do was open the file.
thanks so much for your help
lucien
 
Upvote 0
Is there any other code?

Where is this code located?
 
Upvote 0
no other code. it is located is a file called p2_dpr. this is a file that we have on the screen 24 hours a day. when we take readings in the plant we add them to this file. at midnight we print new logsheets, the 2hrlog is one of them, figured if i could make it work with one i could get it working on the rest. i have tried carefully recording a macro with no luck. the macro will step through with no problem and if i go to the macros and pick the macro and tell it to run, it will with no problem, but the shortcut won't work

thanks again
lucien
 
Upvote 0
If you go to the macro list and pick the Macro that works, click on Options and see if it has the proper "ShortCut" you are using.
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,251
Members
448,556
Latest member
peterhess2002

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top