vba

How to set password when someone clicks on unprotectsheet in excel and create a button for editing

I have locked cells in a spreadsheet using this lines of code. Range("A1:D23").Select Selection.Locked = True ActiveSheet.Protect Contents:=True This prompts me whenever I click on a cell which is readonly to unprotect sheet from review tab and might be prompted for password. My problem is, it is not prompting for password.How do I f...

How to write code on unprotect sheet in review tab

I'm unprotecting my sheet by entering password.When I click on OK apart from Worksheet protection changing I want to write soem other code.How do I do this ...

VBA: Word 2010 - Close Header & Footer Tools with VBA

Hello, I'm using a macro, which inserts a text into the footer. After the macro has finished, the Header & Footer Tools are active, so I'm in the editing mode for the footer. Does anyone know how to close this editmode with VBA? Thanks ...

Excel Macro: error when pasting - moving down 10 rows - pasting - 10 rows - pasting, etc

I'm attempting to copy data from three workbooks (one at a time) from the same range (A4:A8) and paste them into a new workbook. The only catch is I'm trying to make the paste part move down by 10 lines each loop. I'm receiving an error message on the PasteSpecial line. I'm not sure why? (I'm an Excel macro novice, but I'm giving it a ...

Calling python script from excel/vba

Hello guys, I have a python code that reads 3 arguments (scalars) and a text files and then returns me a vector of double. I want to write a macro in vba to call this python code and write the results in one of the same excel sheet. I wanted to know what was the easiest way to do it, here are some stuffs that I found: - call the shell() ...

Excel VBA: Save As triggers Change event in ComboBox

I have an Excel workbook containing some ComboBox controls placed directly on the sheets. These are standard combo boxes from the Forms toolbar. When the user uses "Save As" to save the workbook with a different name, this triggers the Change event on all the combo boxes, including ones on sheets that aren't active. This seems unreasona...

Powerpoint - Getting the original Shape from inside a Placeholder (programatically)

I'll give an example with a SmartArt Shape, but it could be asked about other shapes too. When I go over Slide.Shapes, one of the Shapes has: Shape.Type=msoPlaceholder and Shape.PlaceholderFormat.ContainedType=msoSmartArt Is there a way to get to the actual SmartArt Shape contained in the placeholder? Thanks, Arie ...

Excel VBA dropdown list

Hi all, I have a dropdown list where it gets the data from a table called table1 in the SQL Server 2005. There is a button next to the drop downlist to add new data to table1. when I click the button and successfully add the new record to table1, I don't see this new added record in my dropdownlist. I have to close the excel sheet and re...

Unit testing in MS Access

I have an Access database project that is getting a bit to large to try to keep track of in my head. I know it is a little late in the game, but better late than never right? I have Googled but found nothing to my satisfaction. Is there any such thing as a unit testing framework for MS VBA? ...

How to detect a cell is selected for editing in excel

I have a range of readonly cells.After that all other cells are editable.I want to know how can I detect this cell editing event.Like if cell A25 is edited,I want to call a procedure. If Cell(A25).edited then do this.Some thing like this ...

how to load a sectioned CSV file to an excel sheet?

CSV file: #3GMACRO,,,,,,,,,,,,,, ,,,,,,,,,,,,,, IMSI,IMEI,Date,Time,UMTS MACRO-UARFCNDL,UMTS MACRO-PrimaryScramblingCode,UMTS MACRO-CPICHTxPower,UMTS MACRO-PLMNCellId,UMTS MACRO- RNCId,UMTS MACRO-MCC,UMTS MACRO-MNC,UMTS MACRO - LAC,UMTS MACRO - RAC,UMTS MACRO - MaxUETxPower,UMTS MACRO - MeasuredRSCP 2.6275E+14,3.57539E+14,20100107,16000...

Run time error 1004:Application defined or object defined error on range object

Dim collet As String collet = ThisWorkbook.ColLetter(ColCount) + ":" + LTrim(Str(Target.Row)) Set my_r = Target(collet).Select I'm getting the runtime error at the last line in my code.Cannot figure out why ...

MS Access perform POST webrequest

In my MS Access application I need to send a batch of info to my webserver on a regular basis. I don't need anything fancy like SOAP, XML-RPC or anything, just a simple POST page request is sufficient. I've Googled a bit but have been unable to turn up anything really helpful. Does anyone know of a resource or have a code sample to perf...

Can VBA API be performed in .net?

We are trying to improve the administrative UI to an application we have that uses Excel as a portal to a proprietary DB. All the APIs are written in VBA thus every thing is done in Excel. Rewriting the APIs does not appear to be an option at this time. Is there anything we an do to use those APIs in the .net environment? ...

How to insert a Please Wait form while a query is running

I want to display a "Please Wait" form while a 60+ second query is running. I have the query and the form made (easy enough), except the macro won't bring them together. Here is my autoexec macro: SetWarnings=False Open Wait Form Run the query & Display Results Close Wait Form The problem is that I can only see the outline of my wa...

VB error catching

Hi , My code is as below conDB.Execute strSQL, recordsAffected Sheet1.Cells(intStart, 5) = IIf(recordsAffected > 0, "Success", "Failure") Intread of printing failure i want to print the error description. I tried Sheet1.Cells(intStart, 5) = IIf(recordsAffected > 0, "Success", Err.Des) but it doesn't work. Any ideas? ...

why Val(oldP) get 1 when oldP="32" ???

i have an old string say oldString="abc-2" i want to change it to "abc-3" so i did this myArray = Split(oldString, "-") oldP = myArray(UBound(myArray)) myArray(UBound(myArray))= Str(val(oldP) + 1) newString=join(myArray,"-") why do I get the wrong number?? and if i try to use Cint(), then i got Error. please help... just found the r...

VBA Textbox loses focus on 'Alt-Gr'

Hi, I am experiencing a funny behaviour of Textboxes on a VBA Userform: On pressing Alt-Gr the box loses focus. This happens after running a bit of VBA initialization code for the form. The text box has neither initialization code nor event listeners. Starting the user form straight out of the IDE everything is fine. I suspect a MS Off...

Excel: VBA and refreshall ended message?

This is Excel 2003. I'd like to know how long it takes an external query to complete and then update a cell in my spreadsheet with that ET. I have the following, but it doesn't work because the ET is only as long as it takes to initiate the refresh: Sub Refresh() Dim StartTime, EndTime, ET StartTime = Timer ActiveWorkbook....

Use ADOX or ADOX and ADODB to query and edit data

I am trying to figure out how to use ADO and ADODB to get data and view it while also being able to determine the PK so that I can alter data. My plan is to use ADODB to display some data to an end user in Excel, if the user wants to edit the data there will be a macro monitoring cell changes and then sending the change to the database....