Force 'Save As' Through CommandButton

Apr 1, 2009

I have created a tool in excel to facilitate different requests from our sales force. A drop down list in the first worksheet lists the request types. Once the type is selected the user clicks a command button that sends the user to the corresponding worksheet specific to the request type.

My problem is that I need to verify that the cells on the specific worksheet have all been completed. I tried to verify when saving in the workbook module, but I don't know how to only check the selected request worksheet.

One thought was to insert save command buttons on each worksheet and only allow saving through those buttons. (So I would need to remove any saving functionality from the file menu/toolbar.) Then I could attach the verification code to that button on each worksheet. Preventing saving until the requested data was entered.

If this methodology will work I need to know how to do the following:

1) remove alternative saving methods

2) Once those methods are removed, how do I code a command button to check that specific cells are not null and then "save as".

3) if cells are null then, stop save and show msgbox.

I am working in Excel 2003.

View 9 Replies


ADVERTISEMENT

Textbox Enter Key To Force Execute Commandbutton

May 26, 2007

In my userform, I have a textbox where I enter a number.

When I hit the return key in the textbox, I want the userform to act like I hit a commandbutton_Click. (The commandbutton_Click takes the contents of the textbox and locates a line with that number in it in a specific worksheet, and then displays the line of info in other textboxes in the userform).

I have not been able to figure this out.

View 9 Replies View Related

How Userform Commandbutton Actually Save Data Into Excel Sheet

Feb 21, 2014

I have a Userform.Which is working perfectly to send data to excel sheet.

In the userform there is command button (commandbutton1) which is used to send data to excel sheet...This only send data but it actually does not save it into excel sheet.When I close excel sheet it asks do you want to save changes?

But I need when commandbutton1 is press to send data to excel sheet , it should actually save data into excel sheet.

[Code] .....

View 2 Replies View Related

Force Save As Type To Xls?

Feb 16, 2014

I've looked through the threads and have seen some Save As posts, but nothing that seems to fit my task. All I want to do is force the Save As file type to .xls (for some reason on our network, xlsm causes save errors... After looking through various posts, I found this:

VB:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Not SaveAsUI Then
Exit Sub [code]....

The problem is this causes the Save As dialog box to show up twice... How I get the Save As dialog box to show up once?

View 4 Replies View Related

Force Save Of File

Jan 9, 2008

I need to know the line or two of code to disable the
FILE and CLOSE buttons to force saving to the same file.

I know they exist, because I obtained and tested them in
an excel sheet, but somehow managed to lose the code
and the link from which I obtained them.

View 4 Replies View Related

Force Save As File Destination?

Mar 28, 2014

I am trying to save my workbook to a file on my shared drive.

When I change the default save location in the options menue it works fine for the first instance but when I return and open the file ... even the one from the shared drive it faults back the C: drive location on my laptop. My excel version is 2010 and my code for file name is below ... I just dont know how to force the path/destination in VBA

Code:
Dim namefile As Variant
With Worksheets("Panelas")
namefile = .Range("V3") & "_" & .Range("C5") & "_" & .Range("P3") & "_" & Format(Now, "yyyy-mm-dd") & ".xlsm"
End With
namefile = Application.GetSaveAsFilename(namefile, fileFilter:="Excel Files (*.xlsm), *.xlsm")

[code]....

View 7 Replies View Related

Force To Save / Protect Macro

Dec 17, 2009

I've created a file where our accountmanagers can mace price calculations. But eversince i've added a macro to force them to fill the form completely, they have gone and tried to hack the macro (and with succes).

I now would like to add a protection for the macro, so they can only access VBA when "sheet1" is unprotected. How can i do this?

I also would like to create a macro so they only can save the file as a Macro Enabled Excel file (.xlsm),

how can i do this best? .....

View 9 Replies View Related

Force File Name From Cell On Save As

May 1, 2009

When you click File>Save As, you get a save as window that shows the current file name to "Save As"

I would like to create a macro that shows the values in a couple of cells (lets use Range("A1") & Range("B2")) instead of the current file name.

View 4 Replies View Related

Short Key / Hot Key For CommandButton?

Oct 3, 2011

One of my commandbuttons will every now and then be covered by the FormulaBar, is it possible to assign a short key/ hot key for its function (CTRL+q)?

CommandButton's code:
Private Sub CommandButton3_Click()
Select Case ActiveCell.Interior.ColorIndex
Case xlNone: ActiveCell.Interior.ColorIndex = 3
Case 3: ActiveCell.Interior.ColorIndex = 6
Case 6: ActiveCell.Interior.ColorIndex = 10
Case 10: ActiveCell.Interior.ColorIndex = xlNone
End Select
End Sub

View 7 Replies View Related

Use String To Set As Commandbutton

Sep 18, 2008

I have a large number of commandbuttons on a userform that I wish to apply captions to via a for loop. Each button is numbered appropriately for this purpose. e.g.

Button_1, Button_2 etc etc

I want the loop to compile a string that represents the button name e.g.

String = "Button_" & Loop_Count
and then use my defined commandbutton:

Dim My_Button as commandbutton
to name the buttons. So the loop would be something like:


for Loop_Count = 1 to 100

String = "Userform_Name.Button_" & Loop_Count
set My_Button = String
My_Button.caption = "Test_" & Loop_Count

next Loop_Count
Unfortunately trying to set 'My_Button' using a string like this doesn't work.

View 9 Replies View Related

CommandButton On WorkSheet

Jan 16, 2009

I have a commandbutton (CommandButton1) on a worksheet ("SCHEDULE"). I was wondering if there's a way to freeze the commandbutton on the bottom, on the right... I would like that, when you scroll down or to the right, the commandbutton doesn't move....

My code is:

Private Sub CommandButton1_Click()
Dim ScrollRw As Long 'Botón De comando parte inferior izquierda
Dim ScrollCol As Integer 'de la hoja "PROGRAMACION"
ScrollRw = ActiveWindow.ScrollRow
ScrollCol = ActiveWindow.ScrollColumn
Modulo1.BorrarTabla 'Código que borra la tabla

View 9 Replies View Related

Cut And Paste Not Working With CommandButton

Jun 3, 2014

When I click a commandbutton to cut and paste columns I get the following error:

Select Method of Range class Failed

This is the following code I have

[Code] .....

Why this is happening?

View 3 Replies View Related

Round CommandButton In Userform?

Feb 12, 2014

Is it possible to have a round commandbutton in userform?

View 3 Replies View Related

Excecute A Macro From A Commandbutton

Mar 9, 2009

I have a little problem with a userform commandbutton that I cannot resolve. I cannot seem to excecute a macro from a commandbutton, but if I go to the VBA project I can get it to work from there.

The cmb just calls a macro, which in itself call 5 other macros. This is the code for the button:

View 4 Replies View Related

CommandButton To Clear Textboxes In Vba

Mar 12, 2009

Can I use a commandButton too clear data out of my textBoxes. Been reading a lot and do not understand how,I'm the type of guy if you show me too the water I will drink it. I will send a example of what I want too do.

View 3 Replies View Related

CommandButton And FIND Fails

Sep 16, 2009

Haven't done a LOT with forms, but this should work (in my mind) and doesn't.

I'm using a ComboBox linked to a named range of "DATES" for a user to select a date. All I want to do is find that date in column A of the Sheet1.

View 7 Replies View Related

Create New Worksheet From Commandbutton

Sep 17, 2009

I have a userform which collects fuel data from a pump and populates 2 worksheets (pump1) and (pump2). What I am tyring to accomplish is the following:

When fuelling is finished for the day, the operator selects the (Shutdown) button. When this happens I need the userform to perform the following.

1. For each worksheet (pump1) and (pump2) create new worksheets named (pump1_date) and (pump2_date).

2. Populate these new worksheets with the entire data from the original worksheets.

3. Clear out all but the last row of data from the original sheets. The last row contains the meter readings for the fuel pumps and needs to stay as an opening ballance for the next day. This last row to become the top row of the original sheet.

View 7 Replies View Related

Commandbutton Error '287' When Cancelled

Feb 19, 2010

I've have a button to open a file on my first sheet When I click on the button a window pops up to open or cancel the action. There are no problems when I click OK to open the file. but when I cancel I get a runtime Error '287' Application-difined error.

View 4 Replies View Related

Link A CommandButton To Another File

Jul 25, 2008

linking a CommandButton to another File. I made a CommandButton but would now like to know how to write the Macro to make that Button, when clicked, bring me to a file saved in Excel.

View 9 Replies View Related

CommandButton, Text Box, Calculator

Dec 28, 2009

I am trying to make a calculator inside of Excel...learning how Text Boxes work in conjunction with CommandButton. I am trying to code the button to display inside of the text box. I have never coded a text box before to do anything like that

note: For right now i am just looking at being able to click on a button [numbered 0-9] and have them dsplayed inside the text box. After that I want to be able to set up an addition, subtraction, etc button to actually have the math done.

View 9 Replies View Related

Creating CommandButton With Code

Sep 9, 2006

how to create commandbutton code so let me explain what I am trying to do and anyone that could provide me with some basic code details to solve my problem:

When the command button is clicked in an excel worksheet I want a pop up box to come up containing specific information sourced from two other excel worksheets depending on the commandbutton. What I want to know is what code do I enter from the visual basic view in order for the box to appear with the right information.

View 2 Replies View Related

Anchor-Fix CommandButton To A Cell

Nov 10, 2006

Is there any way to bind a Commandbutton to a cell's location, so that when column widths or row heights are shifted, that the CommandButton moves with the cell?

View 3 Replies View Related

Change Commandbutton Color

May 1, 2007

I have a workbook with multiple sheets and a different number of command buttons per sheet. How can I create a loop to color these command buttons? I have been successful at changing the size of the command buttons but not the color. The commandbutton is grouped with a chart.

Dim grp As Shape
stp = ThisWorkbook.Sheets.Count
strt = stp - 2
For a = strt To stp
b = 0
For Each grp In Sheets(a).Shapes
Sheets(a).Activate
Range("A1").Select
grp.Select
Selection.ShapeRange.GroupItems(6).Top = 100 'works
Selection.ShapeRange.GroupItems(6).BackColor = vbBlack 'doesn't work
Next grp
Next a

View 3 Replies View Related

Run CommandButton Code From Another Macro

Sep 18, 2007

I'm trying to loop through several objects and fire their "Click" events, but I'm not sure how to get it to work.

Below is an example of what I was trying to do. There are 3 objects with the name "CommandButton(1-3)".

Private Sub RunAll_Click()
Dim obj As Object
For i = 1 To 3
Set obj = UserForm1.Controls("CommandButton" & i)
obj_Click
Next i
End Sub

View 9 Replies View Related

Assign Macro To Commandbutton

Dec 13, 2007

From the Control Toolbox I click on the command button icon. I positon the mouse where I'd like to place the command button and draw the command button. Then right click to open the drop down menu. A few days ago in the drop down menu I had an option Assign Macro but now I don't have it anymore. How is it possible to assign macros to the command button and even better how can I get the Assign Macro option back in the drop down menu?

View 2 Replies View Related

Macro Debugs When Run Via CommandButton

Jan 17, 2008

I have an unusual problem with my excel workbook. The workbook consists of 2 sheets, "WorksOrder" and "Data". In the WorksOrder sheet, the user enters some WorksOrder number and then hits a Commandbutton to retrieve the data from SQL and stores it in the "Data" sheet. It then goes and copies the values from the Data sheet. The problem occurs when it's trying to copy a cell value in Data into a WorksOrder cell. The error I get is Run-time error '1004': Application-defined or object-defined error

The weird thing is, when I'm stepping through the code, I don't get the error message and the code works. It only happens when the code is triggered from the Commandbutton. I've tracked the error to a variable which supposed to have a row number greater than zero but instead has a zero (0) value. My question is why isn't the function returning the value to the variable ThisRow? The code for copying the cell data is listed below:

Dim ThisRow As Long
Dim ThisWorksOrder As String
ThisWorksOrder = "123456"
ThisRow = FindRowNumber(ThisWorksOrder)
Worksheets("WorksOrder").Range("D1").Value = WorkSheets("Data").Range("H" & CStr(ThisRow).Value.............

View 5 Replies View Related

Delete Forms CommandButton On Worksheet

Jun 5, 2006

How do I delete a command button I've entered on my Worksheetright-clicking does nothing;control-key+right-click does nothing alt+ctl+right-clicking does nothingWhat's the secret?

View 8 Replies View Related

CommandButton Generate Number When Pressed

Jan 25, 2009

I want to get number (going from 1 to 15 (for example)) when i click on commandbutton (on userform without textboxes, combos , etc, ..... except only one commandbutton)!

In other words, when i click on commandbutton, i want to get (on msgbox) number 1, then when i click again on commandbutton, i want to get number 2, then when i click on it third time, i want to get number three on msgbox window, and so on until i close userform!

View 12 Replies View Related

MSForms.CommandButton Not Working Properly

Jan 29, 2009

I have a form with 2 buttons and a frame. Inside the frame I have another button. I get a Type Error Message when I run the code and I don't understand why.

View 3 Replies View Related

CommandButton Caption Text Clipped

Oct 14, 2009

I have a commandbutton who's caption text is getting clipped along the bottom when I view the sheet at 100% zoom. If I look at 200%, the text is fine. What's going on here? I've included a pic of the offending button. Note the missing bottom part of the "g".

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved