# How to read a vba code of another excel using vba code

How to read a vba code of another excel file using vba code

Posted by on

• Level 1:

An expert who has achieved level 1.

Corporal:

An expert that hasĀ over 10 points.

Mayor:

An expert whose answer gotĀ voted for 2 times.

• Contributor

R u talking of macros?

Posted on Jun 30, 2008

• Level 1:

An expert who has achieved level 1.

• Contributor

'If the user forgets to write something in the number place-holders,
If aTxt.Text = "" Or bTxt.Text = "" Or cTxt.Text = "" Then
'than tell him
msg = MsgBox("You forgot to enter a number.", vbCritical + vbOKOnly, "Error")
'and exit this sub
Exit Sub
End If
If aTxt.Text = 0 Then
msg = MsgBox("That isn't a quadratic equation, a musn't equal 0.", vbCritical + vbOKOnly, "Error")
aTxt.SetFocus
Exit Sub
Else
'Assigns the values the user gave to a, b and c
a = aTxt.Text
b = bTxt.Text
c = cTxt.Text
'and calculates the discr and the Apex
discr = (b * b) - (4 * a * c)
ApexX = (-b) / (2 * a)
ApexY = -discr / (4 * a)
End If
If discr < 0 Then
Msg3.Caption = "There are no answers for " & a & "x² + " & b & "x + " & c & " = 0." & vbCrLf & vbCrLf & "The coordinates of the apex are (" & ApexX & ";" & ApexY & ")."
ElseIf discr = 0 Then
x = (-b) / (2 * a)
Msg3.Caption = "The answer for " & a & "x² + " & b & "x + " & c & " = 0 is " & x & "." & vbCrLf & vbCrLf & "The coordinates of the apex are (" & ApexX & ";" & ApexY & ")."
ElseIf discr > 0 Then
x1 = (-b - Sqr(discr)) / (2 * a)
x2 = (-b + Sqr(discr)) / (2 * a)
Msg3.Caption = "The answers for " & a & "x² + " & b & "x + " & c & " = 0 are " & x1 & " and " & x2 & "." & vbCrLf & vbCrLf & "The coordinates of the apex are (" & ApexX & ";" & ApexY & ")."
End If

Posted on Jun 24, 2010

Hi,
a 6ya Technician can help you resolve that issue over the phone in a minute or two.
Best thing about this new service is that you are never placed on hold and get to talk to real repair professionals here in the US.
Goodluck!

Posted on Jan 02, 2017

×

my-video-file.mp4

×

## Related Questions:

Apr 15, 2013 | Computers & Internet

### What is exel sheet extension in office 2010 ?

Excel Workbook

.xlsx

The default Excel file format. Cannot store VBA macro code or Microsoft Excel 4.0 macro sheets (.xlm files in Excel 4.0).

Excel Macro-Enabled Workbook

.xlsm

Uses the same basic XML format as the Excel Workbook, but can store VBA macro code. Users saving an Excel workbook that has VBA code or Excel 4.0 macro sheets (.xlm files in Excel 4.0) are prompted to use this file format.

Excel Template

.xltx

The default file format for an Excel template. Cannot store VBA macro code or Excel 4.0 macro sheets (.xlm files in Excel 4.0).

Excel Macro-Enabled Template

.xltm

Can contain a VBAProject part or Excel 4.0 macro sheets (.xlm files in Excel 4.0). Workbooks created from this template inherit the VBAProject part or Excel 4.0 macro sheets that exist in the template.

.xlam

A supplemental program that runs additional code. Excel add-ins use the Open XML file format to store data, and they support using VBA projects and Excel 4.0 macro sheets.

Feb 21, 2011 | Computers & Internet

### CODES for entering an I.D number using vba

Try the help built into Excel and give yourself time to absorb it; Excel has some of the best help in the business. VBA may be more complex than you need to solve a data entry problem. If you're trying to add data input masks in a database, why don't you try Access (the help for which is admittedly weaker because database programming is among the most complex of all productivity apps)? I learned VBA from 3 books I rented from a good public library over the course of a project that was about a month long, (because) at some point Microsoft abandoned the idea of teaching it via help screens. Still, you might join a MS developer site and those are loaded with detailed explanations and many other experts. I hope this helps... I feel your pain.

Mar 22, 2009 | Microsoft Office Excel 2003 for PC

### Office 2007 Standard - VBA not working

There is no indication that VBA should not work in all versions of Excel. There is a new file extension (xlsm), which is used to activate macros and allow usage. If you have, perhaps, opened and saved with incorrect extension (new is xlsx), VBA may be unavailable. Try to resave it with the changed extension. It seems likely that this is the issue (reference http://office.microsoft.com/en-us/excel/HP100141031033.aspx?pid=CH100648071033). Also, if you make sure your Save As option is set at xlsm, this should help to prevent problems. VBA should not be an issue in any version of Excel and custom functions ARE available (see http://office.microsoft.com/en-us/excel/HA102189961033.aspx?pid=CH100645021033). It should be as simple as changing the extension, and I would suggest changing the default save as option. If this helps, please rate "FixYa"! Thanks!

Apr 03, 2008 | Microsoft Office Standard for PC

Can you read the code at all?

If yes, try copying the code to a new VBA screen and pasting it in.

Do your changes in this screen and save it as a Macro, then delete the original.

Note: I use a blank password on all my protected documents - not real good security, but easy to remember and others don't know that it is to be left blank - so it foils a lot of people. I use the password only to protect the formulas and script from being changed accidentally by the end user - not to prevent anyone from "stealing" my code.

VBA passwords seem to be difficult to crack and the programs to do so seem to be quite expensive for a one time use.

Have you thought of just rewriting the VBA script? Remember, you did it once and went through all the problems of working out the sequence etc so much of this might come back to you and save a lot of time over the original exercise.

Good luck.

Mar 26, 2008 | Microsoft Excel for PC

You can but you will need software. Search for google for VBA password recovery tools. Search for the appropriate crack you have it all . .

Dec 30, 2007 | Microsoft Excel for PC

## Open Questions:

#### Related Topics:

424 people viewed this question

Level 3 Expert

Level 3 Expert

Level 3 Expert