$$Excel-Macros$$ Method now fails
This routine USED to work. I added two lines of comment to indicate the problem. ... vNam = Cells(2, 7).Text + "V" 'board voltage pPath = "D:\ANALOG\HVREG\Boards\TITANTWO\TT_C\Jumpers\" ActiveSheet.Shapes(1).Select ' ERROR: Method of 'Active Printer' of object '_Application' failed ' Application.ActivePrinter does not get set Application.ActivePrinter = "Acrobat PDFWriter on FILE:" ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=False, _ ActivePrinter:="Acrobat PDFWriter on FILE:", PrintToFile:=True, _ Collate:=False, PrToFileName:=pPath + vNam Kill pPath + vNam 'only PDF left ... Be advised that the error exists no matter the default printer setting, so please do not say "change the printer default". Excel mandates that the value for Application.ActivePrinter be set, so please do not say to remove that line of code. I am looking for a useful solution (or a possible reason as why it no longer works). Thanks. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at https://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout.
$$Excel-Macros$$ Cannot remove metadata folder(s)
In an Excel macro, inside a loop I issue the following, where the names are unique each time: Workbooks.Open Filename:=openFYL$ With Worksheets(1) ' .Copy''do not need; saves BOOKn space .SaveAs svWK$ End With ' NOTE: Related metadata folders are created on the fly Open svWK$ For Input As #1 'EG: "USE_P001.TXT" When the loops are done, then and only then can i attempt to close and remove the files. Close 'MUST close files, for removal For PG = 1 To 7 '* Remove parsed secondary files for minimum handles For nsnFIND = 1 To 11 FPG$ = Right$("000" + Mid$(Str$(PG), 2), 3) REF$ = Right$("0" + Mid$(Str$(nsnFIND), 2), 2) svWK$ = "DET_R" + FPG$ + REF$ + ".txt" On Error Resume Next'** NOTE: does not always work Workbooks(svWK$).Close SaveChanges:=True Kill sav2$ RmDir deeFAULT$ + "DET_R" + FPG$ + REF$ + "_files" Next nsnFIND '* Remove parsed primary files for minimum handles FPG$ = Right$("000" + Mid$(Str$(PG), 2), 3) svWK$ = "DET_P" + FPG$ + ".txt" Workbooks(svWK$).Close SaveChanges:=True Kill svWK$ 'deeFAULT$ = "C:\Users\BOB\Documents\" ' PATH AND FILE NAME IS CORRECT ' Furthermore, the folder can manually be removed ' while program is running! dirLOC = deeFAULT$ + "DET_P" + FPG$ + "_files" On Error Resume Next ' to bypass access error RmDir dirLOC '** Path/File access error On Error GoTo 0 Next PG So,the folder specification in each case is absolutely correct, and as i indicate,i can manually delete/remove any one of them WHILE THE PROGRAM IS RUNNING (and creating more). How the heck can this be fixed? -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at https://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout.
$$Excel-Macros$$ How can one control data entry and truly protect a verified entry
Assume one has a spreadsheet with some titles and column headings, along with a row of data already filled out by an automated copy from a previous "journal". Pardon this is long; think i have given all what i want out of this Excel "program". Assume previous journal (sheet) had a number,want this new one to be given (show) in $B$4 the next number. Want $B$3 to be current date. After that, want all cells $A$1 to $P$8 to be locked out from any attempt to change; better yet, no visiting allowed. Input cell at this time is $A$9 and input cell is advanced to $B$9; after contents are verified to be integer numeric,then that cell is locked and only then input cell is advanced for next entry and that is verified according to preset rules for that cell, which is then locked out. This continues to right up to and including $I$9; values are calculated for cells $J$9 to $P$9; and then all of those cells are locked out. At this point,row 9 is locked and this process is repeated for row 10, etc to row 33. Row 35 accumulates sums for the appropriate columns, and the user is locked out from making changes. Row 6 values and row 35 get added into row 37 and is similarly locked. Column K is calculated as a receipt number,incrementing as each row is completed by the user. Per rules above, the user is locked out and cannot change it. Rows not filled out by user remain empty. Then a new "journal"/sheet is made with old row 37 copied to new row 6, the journal number is incremented and the locking and forced data entries as mentioned continue. HOW can this be done (Excel 2003)? -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout.
$$Excel-Macros$$ Re: How can one control data entry and truly protect a verified entry
On Saturday, October 18, 2014 8:16:05 PM UTC-7, Robert Baer wrote: > > Assume one has a spreadsheet with some titles and column headings, along > with a row of data already filled out by an automated copy from a previous > "journal". > Pardon this is long; think i have given all what i want out of this > Excel "program". > > Assume previous journal (sheet) had a number,want this new one to be > given (show) in $B$4 the next number. Want $B$3 to be current date. After > that, want all cells $A$1 to $P$8 to be locked out from any attempt to > change; better yet, no visiting allowed. > Input cell at this time is $A$9 and input cell is advanced to $B$9; after > contents are verified to be integer numeric,then that cell is locked and > only then input cell is advanced for next entry and that is verified > according to preset rules for that cell, which is then locked out. > This continues to right up to and including $I$9; values are calculated > for cells $J$9 to $P$9; and then all of those cells are locked out. > At this point,row 9 is locked and this process is repeated for row 10, > etc to row 33. > Row 35 accumulates sums for the appropriate columns, and the user is > locked out from making changes. Row 6 values and row 35 get added into row > 37 and is similarly locked. > Column K is calculated as a receipt number,incrementing as each row is > completed by the user. Per rules above, the user is locked out and cannot > change it. > Rows not filled out by user remain empty. > > Then a new "journal"/sheet is made with old row 37 copied to new row 6, > the journal number is incremented and the locking and forced data entries > as mentioned continue. > > HOW can this be done (Excel 2003)? > ** Easily found way to "go to" a given cell for data entry: Range(RowStart).Select. However, there seems to be no way to have the script wait for user input (and then check appropriate conditions) before going to next logical step. If that can be done, it seems i could write the script to do most of what i want. The locking out i want would seem to be yet another problem. Suggestions? Thanks. -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout.
Re: $$Excel-Macros$$ Re: How can one control data entry and truly protect a verified entry
On Monday, October 20, 2014 12:48:25 AM UTC-7, Vabz wrote: > > Hi can you share sample files... > > + > > Here is what i have so far..present question imbedded Dim Avar As String, Nvar As Integer Dim Frow As Integer, Fcol As Integer ' Start row data entry Frow = 9: Fcol = 1 ' aka "A" Cells(Frow, Fcol).Select Avar = "" While Avar = "" ' CellLoc = ActiveCell.Address ' eg: $A$9 Avar = ActiveCell.FormulaR1C1 ' eg: user enters "88" ' want to wait for user entry; obviously i now have a wait working, BUT. ' stays in this loop forever; user CANNOT enter anything! Wend ActiveCell.FormulaR1C1 = UCase$(Avar) Fcol = Fcol + 1 'now $B$9 Nvar = 0 While Nvar = 0 Nvar = ActiveCell.FormulaR1C1 ' check alfa? Wend x = x '<-- Justin Case break point for debugging ** Thanks -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout.
Re: $$Excel-Macros$$ Re: How can one control data entry and truly protect a verified entry
WOW! That works! Thanks a lot! Attempted to try: Private Sub Workbook_SheetSelectionChange(ByVal WkSh As Object, ByVal AmAt As Excel.Range) ' Supposedly runs when a sheet selection (cell?) is changed. whatName = WkSh.Name: wheregot = AmAt If wheregot <> CellLoc Then X = X ' set as a breakpont; NEVER happens End If End Sub ..which never executed, so that idea was DOA. The Application.InputBox() is perfect. Thanks again. On Wednesday, October 22, 2014 2:00:11 AM UTC-7, Vabz wrote: > > you can use this to work on VBA > > Sub RB() > > Dim Avar As String, Nvar As Long > Dim Frow As Integer, Fcol As Integer > ' Start row data entry > Frow = 9: Fcol = 1 ' aka "A" > Cells(Frow, Fcol).Select > Avar = Application.InputBox("Enter value!!", Type:=3) > ' want to wait for user entry; obviously i now have a wait working, > BUT. > ' stays in this loop forever; user CANNOT enter anything! > ActiveCell.FormulaR1C1 = UCase$(Avar) > Fcol = Fcol + 1 'now $B$9 > Nvar = 0 > While Nvar = 0 > Nvar = ActiveCell.FormulaR1C1 > ' check alfa? > Wend > > End Sub > > > + > *I did not do this for you. God is here working through me for you.* > > On Tue, Oct 21, 2014 at 12:39 AM, Robert Baer > wrote: > >> >> >> On Monday, October 20, 2014 12:48:25 AM UTC-7, Vabz wrote: >>> >>> Hi can you share sample files... >>> >>> + >>> >>> >> Here is what i have so far..present question imbedded >> Dim Avar As String, Nvar As Integer >> Dim Frow As Integer, Fcol As Integer >> ' Start row data entry >> Frow = 9: Fcol = 1 ' aka "A" >> Cells(Frow, Fcol).Select >> Avar = "" >> While Avar = "" >> ' CellLoc = ActiveCell.Address ' eg: $A$9 >> Avar = ActiveCell.FormulaR1C1 ' eg: user enters "88" >> >> ' want to wait for user entry; obviously i now have a wait working, >> BUT. >> ' stays in this loop forever; user CANNOT enter anything! >> >> Wend >> ActiveCell.FormulaR1C1 = UCase$(Avar) >> Fcol = Fcol + 1 'now $B$9 >> Nvar = 0 >> While Nvar = 0 >> Nvar = ActiveCell.FormulaR1C1 >> ' check alfa? >> Wend >> >> >> x = x '<-- Justin Case break point for debugging >> ** Thanks >> >> -- >> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s >> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ >> https://www.facebook.com/discussexcel >> >> FORUM RULES >> >> 1) Use concise, accurate thread titles. Poor thread titles, like Please >> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice >> will not get quick attention or may not be answered. >> 2) Don't post a question in the thread of another member. >> 3) Don't post questions regarding breaking or bypassing any security >> measure. >> 4) Acknowledge the responses you receive, good or bad. >> 5) Jobs posting is not allowed. >> 6) Sharing copyrighted material and their links is not allowed. >> >> NOTE : Don't ever post confidential data in a workbook. Forum owners and >> members are not responsible for any loss. >> --- >> You received this message because you are subscribed to the Google Groups >> "MS EXCEL AND VBA MACROS" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to excel-macros...@googlegroups.com . >> To post to this group, send email to excel-...@googlegroups.com >> . >> Visit this group at http://groups.google.com/group/excel-macros. >> For more options, visit https://groups.google.com/d/optout. >> > > -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout.
Re: $$Excel-Macros$$ Re: How can one control data entry and truly protect a verified entry
Color me confused. SheetSelectionChange event? where? This is a typical input i have: B_n:Cells(Frow, Fcol).Select' force location Tytle = "Enter charges:" Avar = Application.InputBox(Tytle) ' returns type text If Avar = "FALSE" Then GoTo B_n ActiveCell.FormulaR1C1 = Val(Avar) Chrg = Val(Avar): ColChg = ColChg + Chrg Fcol = Fcol + 1 '$C$9 <\CODE> I control Frow and Fcol,which does the "locking" i wanted,as user cannot do anything except input data exactly where i want. I save the row data at the end, and give options at the start for "what is next". Now,it would be useful to be able to position that input box, as well as change the font of the text in the box. And, i think lastly, have the app automatically run when the XLS program is launched. Thanks, Robert Baer PS: have yet to test the "FALSE" part (ie: one clicks on "Cancel" in the input box. On Wednesday, October 22, 2014 11:41:41 AM UTC-7, Paul Schreiner wrote: > > I hate to "throw a wrench into the monkeyworks", but: > > you were trying to use the SheetSelectionChange event. > which actually runs for ANY sheet in your workbook, not just a specific > sheet. > > which might be a bit confusing if you have multiple sheets, > and you're using the event macro to "lock" the cells, then it would > actually lock the cells the other sheets as well.. > > Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target > As Range) > > If you only want the macro to run on a specific sheet, you can either test > the Sh object for the sheet name. > Or you can create a similar event macro in the sheet module called: > > Private Sub Worksheet_SelectionChange(ByVal Target As Range) > > Next, if you're wanting to "lock" cells A1:P9, you could use something > like: > > Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target > As Range) > Dim Targ As Range > For Each Targ In Target > If (Not Intersect(Targ, Sh.Range("A1:P8")) Is Nothing) Then > Sh.Range("A9").Select > Exit For > End If > Next Targ > End Sub > > One thing I've run into is that if you select multiple cells, the "Target" > variable becomes an array instead of a simple object. > So I use the Targ variable to loop through the Target selection array. > This works if you select a single cell or multiple. > > In this case, I look for the "intersection" of the selected cell and the > "locked" range. > If the cell is within the blocked range, it returns the range. > (or "Not nothing") > > in which case I selce another cell (which, incidentally calls this event > again) > > The nice thing about this is that if you wish to change the values of the > "blocked" cells using VBA, you don't actually "select" the cell, you simply > have to use something like: > > Range("A2").value = "Test" > > something else you need to be aware of is that the "Target" variable > a range variable, but the address is in "absolute" terms. > That is, if you select cell A9, Target.Address is $A$9 > > So, if you want to test to see if the selected cell is A9, you could use > either: > > If (Targ.Address = "$A$9") then > > or even: > > If (Targ.Row = 9) and (Targ.Column = 1) then > > *Paul* > - > > > > > > > > *“Do all the good you can,By all the means you can,In all the ways you > can,In all the places you can,At all the times you can,To all the people > you can,As long as ever you can.” - John Wesley* > - > >*From:* Robert Baer > > *To:* excel-...@googlegroups.com > *Sent:* Wednesday, October 22, 2014 12:57 PM > *Subject:* Re: $$Excel-Macros$$ Re: How can one control data entry and > truly protect a verified entry > > WOW! > That works! > Thanks a lot! > Attempted to try: > Private Sub Workbook_SheetSelectionChange(ByVal WkSh As Object, ByVal AmAt > As Excel.Range) > ' Supposedly runs when a sheet selection (cell?) is changed. > whatName = WkSh.Name: wheregot = AmAt > If wheregot <> CellLoc Then > X = X ' set as a breakpont; NEVER happens > End If > End Sub > ..which never executed, so that idea was DOA. > > The Application.InputBox() is perfect. > Thanks again. > > On Wednesday, October 22, 2014 2:00:11 AM UTC-7, Vabz wrote