Compatibility of macros in Excel 2010
Hi
I have some excel 2007 files (having some macros) and want to use them in excel 2010. I want to open those excel 2007 files in excel 2010. Does my macros works in excel 2010.
Can you please send some support documents.
Regards
Abhilesh
Hi
Thank you for using
Microsoft Office for IT Professionals Forums.
For backward compatibility with earlier versions of Excel, such as Excel 97-2003 or Excel 2007, you can use one of several ways to exchange workbooks between
the different versions.
Work in Compatibility Mode You can open a workbook that was created
in an earlier version of Excel and work in Compatibility Mode so that the workbook remains in a file format that can easily be opened again in the earlier version. Compatibility mode is not available for Excel 2007 workbooks.
Download file converters You can use file converters that you
can download to open an Excel 2010 workbook in an earlier version of Excel.
Check a workbook for compatibility If you want to work in the
current file format but have to share a workbook with people who use earlier versions of Excel, you can check that the data is compatible with earlier versions of Excel. You can then make the necessary changes to avoid the loss of data or fidelity that might
occur when that workbook is opened in an earlier version of Excel.
More detailed information you can refer to this article: Use Excel Starter 2010 with earlier versions of Excel
http://office.microsoft.com/en-us/starter-help/use-excel-starter-2010-with-earlier-versions-of-excel-HA010387550.aspx?CTT=1
Additional, you can read this article to learn more: Application Compatibility for Microsoft Office 2010
http://blogs.technet.com/b/ptsblog/archive/2011/02/10/application-compatibility-for-microsoft-office-2010.aspx
All compatibility areas are getting addressed by the full set of tools and programs:
Feature-function change → Compatibility Inspector
ISV applications → OEAT
Add-in compatibility → OEAT
Maintenance/migration of macros → Compatibility Inspector
Maintenance/migration of scripts → Compatibility Inspector
Document fidelity → OMPM
Microsoft Office Code Compatibility Inspector user's guide
http://technet.microsoft.com/en-us/library/ee833946.aspx
Download:
Office 2010 Tool: Compatibility Inspector
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=23c8a7f6-88b3-48ef-9710-9742340562c0&displaylang=en
Changes in Excel 2010
http://technet.microsoft.com/en-us/library/cc179167.aspx
Please take your time to try the suggestions and let me know the results at your earliest convenience. If anything is unclear or if there is anything
I can do for you, please feel free to let me know.
Hope that helps.
Sincerely
William Zhou CHNPlease remember to mark the replies as answers if they help and unmark them if they provide no help.
Similar Messages
-
Macro in Excel 2010 running 10 times slower
I wonder if anyone here could help or explain a strange behavior in Excel 2010! I believe it is a bug in Excel.
In one of my workbooks I had some macros which after running for a while started to slow down (several times slower)!
To make a long story short I striped down the Excel workbook and created 2 really simple workbooks: one runs a macro in 0.25 sec, and a second one that runs the same macro in 3.3 sec. Both have identical macros and identical formulas in Sheet1 (only one
Sheet in each workbook).
Moreover, the "Good copy" workbook slows down if the "Bad copy" is opened. Once the "Bad copy" is closed the "Good copy" gets back to speed.
If the Calculation is set to manual then both are running fast (this points to a workbook re-calculation delay).
If in the "Bad copy" I delete the three columns with formulas and I recreate them in new columns, then the "Bad copy" gets back to running fast again.
It seems that Excel will compute only the required cells when a cell changes, which makes sense.
However, in the "Bad copy" those three columns must have something that triggers a new calculation of that workbook every time the VB writes to a workbook even if the macro runs on another workbook! This is very strange to me!
These simplified workbooks contain only one trivial macro (I made them just to isolate the issue):
Sub simple_macro()
Application.ScreenUpdating = False
Dim starttime, taken
starttime = Timer
For i = 1 To 500
Cells(1, 5).Value = i
Next i
taken = Round(Timer - starttime, 2)
Cells(2, 5).Value = taken
Application.ScreenUpdating = True
End Sub
I do not think you can recreate easily the problem starting with a new workbook, so I wish there would be a way to post here the two copies! I was hoping that someone from Microsoft would take a look at the "Bad copy", because this behavior can
slow down anyone's macro without even knowing it! I think I have other workbooks with the same issue.
Thanks for any comments anyone might have!Hi,
This is the forum to discuss questions and feedback for Microsoft Excel, I'll move your question to the MSDN forum for Excel
http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
George Zhao
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
VB UI builder, RAD, CASE Wizard for creating macro for Excel 2010?
Hello, I wonder if it is available a: rad, case, UI, framework, application wizard that using VBA as its engine may easy the process to create a macro excel 2010; here the link: https://www.dropbox.com/s/62r5wwgf0ziy5ht/sheet.xlsm to the sheet for an example
of what I mean. It is not about a macro recorder task; it is not interactive. Thank you.
Regards, GiuseppeThank you for your interest, this is another link for the same file: http://www.adrive.com/public/rBdrRn/sheet.xlsm
Regards,
Giuseppe -
Excel 2013: Lost VBA Code From Excel 2010
Just upgraded from Office 2010 to Office 2013.
Tried to open several of my Excel spreadsheets created in 2010 with Excel 2013. I have spreadsheets that have VBA to perform several functions and routines.
None of the .xlsm spreadsheets from 2010 work in 2013. I get the following messages:
"The Visual Basic for Applications (VBA) macros in this workbook are corrupted and have been deleted. The macro corruption most likely exists in the current file. To recover the macros, open a backup copy of this file if you have one."
OR ...
"We found a problem with some content in '*******.xlsm'. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes."
Clicking Yes does not help. It removes or tries to fix the issue. Under the developer tab, the "Visual Basic" and "Macros" button is disabled.
I tried 3 of my different workbooks. They all get the same error. I went back to an Office 2010 installation and all the workbooks open file - without error, and the code executes.
Advice?I'm getting the same problem, but with Excel 2010.
I've created a workbook with macros in Excel 2010 and couldn't run it in two computers with office 2010. The same problem as above occurs:
"The Visual Basic for Applications (VBA) macros in this workbook are corrupted and have been deleted. The macro corruption
most likely exists in the current file. To recover the macros, open a backup copy of this file if you have one."
This problem happened with other 2 workbooks with macro. It's curious too that another workbook with macro created by
me is working on these two computers without errors. And, of course, all of the workbooks mentioned works well in the other computers. This problem started when I downgrade the office os this two computers from 2013 to 2010.
None of the solutions proposed above has worked.
Any ideas?
Thanks in advance! -
Macro runs quicker in excel 2010 than excel 2014?
I have a package I developed with numerious macros and pivot tables.
When i open it, it performs some actions using an "open workbook" macro- all the code, tables etc were created using excel 2010- but when i open it using excel 2014 it is considerably slower- are there known differences in the conctruction
of VB code or refreshing of pivot tables that could cause this.
Anyone else experienced this?
Thanks
DavidPeter
I have a number of pivot tables that use the same sheet as their source- I can get one pivottable to refresh using code below- but if I have 2 pivots on different sheets (both being protected) it won't work as it looks for all sheets to be unprotected
first- is there some change to the code to enablePivotTables on all sheets and refresh all pivots at same time (ThisWorkbook.RefreshAll)
Thanks
D
Sheets("sheet2").Protect Password:="xyz", UserInterfaceOnly:=True
Sheets("sheet2").Select
ActiveSheet.EnablePivotTable = True
ActiveSheet.PivotTables(1).RefreshTable -
SSRS 2012 export to Excel 2010 Via IE8 has many compatibility issues
Hi There,
We have many reports in SSRS 2012 which had originally developed in SSRS 2005. When ever we render these report into Excel we face two major issues;
First: After reports render in to Excel (xlsx) format, we have cell, column, row shifting problem and every element of the report is not in the same place as appose to 2005 render to xls format. Second.
for any drill through (link) report all the url will be blocked by Excel.
We use SSRS 2012, Office 2010 and IE 8. Also we don't want to add Export to Excel 2003 feature. In other word we want out put in xlsx.
Any solution, suggestion, hotfix is appreciatedHi Mercede,
According to your description, after you updated SSRS 2005 reports to SSRS 2012, reports render appose to 2005 when export them to Excel, and drill through link is blocked.
Question1:
A report definition file includes a reference to the RDL namespace that specifies the version of the report definition schema that is used to validate the .rdl file. After a report is upgraded locally or on the report server, you might notice additional errors,
warnings, and messages. This is the result of changes to the internal report object model and processing components, which cause messages to appear when underlying problems in the report are detected.
When you open an .rdl file in Report Designer in SQL Server Data Tools (SSDT), if the report was created for a previous namespace, Report Designer automatically creates a backup file and upgrades the report to the current namespace. This is the only way
you can upgrade a report definition file.
In order to improve the efficiency of troubleshooting, I need to ask several questions:
“we have cell, column, row shifting problem and every element of the report is not in the same place as appose to 2005 render to xls format” Could you please provide detailed information about the problem? I would be appreciated it if you could provide
a screenshot.
Did you update the reports by opening the .rdl files in SSDT?
Could you export report to Excel 2003 to see if it displays correctly?
This may be a lot of information to ask for at one time. However, by collecting this information now, it will help us move more quickly toward a solution.
Question2:
I tested the issue in my local machine, when we add drillthrough action to the report, if we select Go to report or Go to URL, the link works fine after we export report to excel. It failed to work when we use javascript:void window.open to open a URL in new
windows, the “window.open” can’t work in Excel because of the JavaScript protocol can work only with an exact page.
For more information about Upgrade Reports, please refer to the following document:
https://msdn.microsoft.com/en-us/library/ms143674(v=sql.110).aspx
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu
If you have any feedback on our support, please click
here.
Wendy Fu
TechNet Community Support
Hi Wendy,
Thank you much for your fast respond. And as for your questions:
1- Yes I did upgrade them by using SSDT tools in VS2012 and then deploy them again into our SSRS2012 report server.
2- For URLs and Hyperlinks, because the action is go to sub report, I used "Go To Report" and by look at content that been blocked by Excel, I have noticed that (Go To Report) action passes IP address of our SSRS Server . I don't know how can I change
it to use the actual path instead.
3- Shifting the Cells and Rows means when I export report (from SSRS 2005) to excel in xls format (Excel 2003 for example), has very same look as it shows in screen, but when I export it from ssrs 2012 to render it in to xlsx format (Excel 2010 in our case)
I face with merging cells and when I compare this xlsx out put with xls out put of very same report I have see the row that used to be on A23 for example now is in A20 or the column that used to be in A7 now is in B9 for example. And required a lot of manual
work on design to work with spaced between text boxes and location of each data region, and overlaps to get the same result. I want to know is there more efficient way to achieve the same out put as xls.
4- I can't export report to render in Excel 2003 (xls) format directly from SSRS server for we don't have that option in our export list, but I did "save it as" xls and faced the same Row, column, cell shifting as with xlsx.
Thank you so much
I am realistic, I expect miracles. -
Using Excel 2010 with SharePoint 2013 Excel services
Hello:
What features are we missing when using Excel 2010 (rather than Excel 2013) with SharePoint 2013 Excel services?
Regards
Jeff GorvitsHi Jeff,
You might want to read the articles below:
https://support.office.com/en-us/article/Whats-new-in-Power-View-in-Excel-2013-and-in-SharePoint-Server-8e3b4259-421e-41fc-a48e-854388ad14d0?ui=en-US&rs=en-US&ad=US
https://support.office.com/en-us/article/Version-compatibility-between-Power-Pivot-Data-Models-in-Excel-2010-and-Excel-2013-188f44fd-3cfd-4aa7-b4e6-a9402653cbf3?ui=en-US&rs=en-US&ad=US
Regards,
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected] .
Rebecca Tu
TechNet Community Support -
How to make Excel 2010 save a HTML report as a file without a folder created
We have a HTML report generated by Oracle Report with headers as below:
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
In Excel 2010, after pressing the "save" button (not "save as"), it will by default save the report as web page format instead of xls, a folder "xxx.files" containing some css, xml and html files are created
in it. If user deletes the folder carelessly, the excel report cannot be viewed at all.
In Excel 2003, we can save it directly in its original format simply by pressing the "save" button, without creating a folder. May I know if there are any options in office 2010, macro or registries settings that can make
Excel 2010 to do the same as Excel 2003 when pressing the "save" button? Thanks!Hi,
According to your description, you want a workaround to avoid creating a new folder when saving a html file in Excel 2010.
In my opinion, this issue is more related to the feature of HTML format or Excel 2010 application rather and I don't think we could resort to a macro or registry settings to avoid that. I suggest you posting it in
Excel IT pro forum for more effective responses.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
I created an Excel template which includes VB and macros as an EXCEL.XLTM template file (I used a template file to keep users from overwriting the sample template file), but I have noticed that when users save the template, Excel 2010 defaults to saving
the new file as a XLSX file (removing all the macros).
I know you can set Excel 2010 to always save as a certain format, but I really would prefer not forcing all Excel files to be macro enabled for the user
Is there a way to default the Save type to XLSM for this template only? Like some code that I could put in that when the users saves, it saves as a macro enabled XLSM type only for this template file?
My users aren't exactly Excel savvy, so I wanted to make it as simple as possible for them.
Thanks!
Alan EdwardsHi Alan,
>> Is there a way to default the Save type to XLSM for this template only? Like some code that I could put in that when the users saves, it saves as a macro enabled XLSM type only for this template file?
In my option, you could achieve this by adding Application.GetSaveAsFilename Method to the workbook BeforeSave event. Some key code like below:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim FileNameVal As String
If SaveAsUI Then
FileNameVal = Application.GetSaveAsFilename(, "Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")
Cancel = True
If FileNameVal = "False" Then 'User pressed cancel
Exit Sub
End If
ThisWorkbook.SaveAs Filename:=FileNameVal & ".xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled
Application.EnableEvents = True
End If
End Sub
But there is a limitation of this workaround, in this workaround, the save as will only support the macro enabled type, other save as types like "xlsx" will be ignored.
For more information about Application.GetSaveAsFilename Method (Excel), you could turn to the link below:
#Application.GetSaveAsFilename Method (Excel)
https://msdn.microsoft.com/en-us/library/office/ff195734.aspx
Best Regards,
Edward
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey. -
Lock Excel 2010 Headers and Footers in Protected Worksheet
Hi,
Is there any way to lock Excel 2010 Headers and Footers in a Protected Worksheet?
Thank You!Hi,
Here is one way to 'lock' the header and footer control, by disabling it in the WorkBook_Open event.
You indicate that the workbook is 'macro enabled', so if you are well versed in VBA please forgive the following
step by step 'how to'.
Copy the following code to the clipboard:
Private Sub Workbook_Open()
Application.CommandBars("Worksheet menu bar"). _
Controls("View").Controls("&Header and Footer...").Enabled = False
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Worksheet menu bar"). _
Controls("View").Controls("&Header and Footer...").Enabled = True
End Sub
Press ALT + F11
Double click 'THIS WORKBOOK' in the Microsoft Excel Objects in the upper left quadrant.
Paste both event handlers into the WorkBook module editing area to the right.
Close the VBE and return to the worksheet.
Save the workbook.
Now, whenever the workbook is opened, the Header and Footer option under the View tab will be disabled (grayed out). When the workbook is closed, the control will be enabled again so it will be accessible in all subsequently opened workbooks.
If you wish to have access to the header and footer for 'maintenance', copy the following macro to the clipboard:
Sub HeadnFoot()
If Application.CommandBars("Worksheet menu bar"). _
Controls("View").Controls("&Header and Footer...").Enabled = False Then
Application.CommandBars("Worksheet menu bar"). _
Controls("View").Controls("&Header and Footer...").Enabled = True
Else
Application.CommandBars("Worksheet menu bar"). _
Controls("View").Controls("&Header and Footer...").Enabled = False
End If
End Sub
ALT + F11 to access the VBE.
INSERT > MODULE
Paste the macro into the module editing area to the right.
Close the VBE.
Press ALT + F8
When the Macros window opens, highlight this macro and click 'Options..'.
Enter a letter to be used as a keyboard shortcut and click 'OK'.
Close the Macros window.
Save the workbook.
Now, when you open the workbook and need to modify the header or footer, press CTRL + your shortcut letter and the control will be enabled. Press the keyboard shortcut again and the control will again be disabled. It is a 'toggle' macro.
Sincerely,
Harry -
"Excel found unreadable content in xlsm excel 2010 do you want to recover"
I have upgraded the Excel 2003 .xls (which has macro) file to Excel 2010 by save as .xlsm. But when i try to open with this in MS Excel 2010. Its showing
"Excel
found unreadable content in 'test.xlsm'. Do you want to recover the contents of this workbook? If you trust the source of this workbook,"
Please suggest the solution.>>I have upgraded the Excel 2003 .xls (which has macro) file to Excel 2010 by save as .xlsm<<
Did you mean you open Excel 2003 file with Excel 2010 Appcliation and save it to .xlsm file?
I found a similar issue with you in thread below, there is a fix:
Install the Visual Basic component in Office 2010. We haven't had the error since!
Control Panel > Programs > select Microsoft Office 2010 and click on Change > Add or Remove Programs > at the bottom of the list click on the plus next to Office Shared Features > select Visual Basic for Applications > I right clicked
and chose Run from My computer > Continue. Reboot when it has finished
You can find more information from threads below:
Excel found unreadable content in "___.xlsm". Do you want to recover the contents of this
workbook? -
Excel 2010 Row numbers disappearing
Question: Bit of an odd one here.
Running Excel 2010 on a WinXP Sp3 box. Issue is only affecting one user and one of his spreadsheets. Sporatically, the actual numbers within the row identifier boxes vanishes, along with the data in the affected rows. The rows are still there, and the rows
above and below are still numbered in the same sequencial order as if the affected rows were still numbered. If we do not notice this before saving spreadsheet, data is lost. If we unhide all cells, the numbers come back, as does the data. The odd thing is,
as I said, the rows are NOT actually hidden, only the row identifier numbers and the data are gone.
Please help! Critical order tracking sheet.Using Windows 7 Professional ver 6.1 (Build 7601 : Service Pack 1) and Excel version 14.0.6112.5000 (32 bit)
A large spreadsheet some 8MB and formatted as an xls file.
I experienced a similar problem with some row numbers and data missing together with some rows being expanded to a height of 550 pixels.
Highlighting the whole row and automatically resetting the height (double clicking bottom edge ) sometimes resets the height, row numbers and data.
Strangely highlighting the row and clicking the bold button also resets the the height, row numbers and data.
Unfortunately these remedy’s do not persist after saving the file and reopening it.
If I resave the "corrupted" xls version as a Macro-Enabled Worksheet .xlsm file all of the issues above disappear.
I hope this helps some one -
Errors opening Excel 2007 spreadsheets in Excel 2010
When I try to open spreadsheets created in Excel 2007 with Excel 2010, I get the error: "Excel found unreadable contenct in 'file name'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click
Yes". Then a Repairs dialog box comes up saying: "Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded. Removed Part: Print options." File then opens fine.
We receive Excel 2007 from various sources. One of my problem is that we are just starting to migrate people to Windows 7 and Office 2010, with most people still on Office XP. The file format converter for Excel 2002/2003 does not work with these
Excel 2007 files. The other problem is that we have macros that are used to open Excel files and import data into other Excel files. Pretty hard to modify these macros to allow for some files that are going to pop up this error, and others that
do not.
What is causing this problem, and what fix is available? We have asked that people save the Excel files in Excel 97-03 format before sending to us, with mixed results.Hi,
Thank you for using Excel IT Pro Discussions forum.
Are you using Office 2010 RTM version? If it is trial version or beta version, I suggest upgrading it to the RTM version.
First, please check if this KB article helps:
Error message when you try to open a workbook in Excel 2007: "Excel found unreadable content in Book_Name"
http://support.microsoft.com/kb/929766
Note: The steps are for Excel 2007. The steps in Excel 2010 are similar.
If the problem persists, let’s also check the following settings in Excel 2010.
========
1.
In Excel 2010, click File > Options > Trust Center > File block settings.
2.
Check the checkboxes before:
Excel 2007 and later Wordbooks and Templates
Excel 2007 and later Macro-Enabled Workbooks and Templates
Excel 2007 and later Add-in Files
Excel 2007 and later Binary Workbooks
Then, try to open the Excel 2007 file in Excel 2010 and check the results again.
Best Regards,
Sally Tang
TechNet Subscriber Support
in forum
If you have any feedback on our support, please contact
[email protected] -
Sending and receivind ADC coefficients from/to soundcard in VBA for Excel 2010
How to send and receive ADC coefficients from/to soundcard(mixer,microphone) in VBA for Excel 2010 (noncom. edition, x64) to Excel macros for DFT (from IDFT), IIR , user defined samples parser (special
noise generator, graphic s(t),S(jw), arg s(jw) soundcard AFR test ) ?
What .dll is need for this (without bass.dll)?Example from internet :
'This project needs a module and a form
'The form must contain two labels, two progressbars, a timer and a checkbox
'Paste this code into the form
Dim hmixer As Long ' mixer handle
Dim inputVolCtrl As MIXERCONTROL ' waveout volume control
Dim outputVolCtrl As MIXERCONTROL ' microphone volume control
Dim rc As Long ' return code
Dim ok As Boolean ' boolean return code
Dim mxcd As MIXERCONTROLDETAILS ' control info
Dim vol As MIXERCONTROLDETAILS_SIGNED ' control's signed value
Dim volume As Long ' volume value
Dim volHmem As Long ' handle to volume memory
Private Sub Form_Load()
Me.ScaleMode = vbTwips
Me.Caption = "Volume meter"
Label1.Move 0, 0
Label1.AutoSize = True
Label1.Caption = "Input level"
Label2.Move 0, 4 * Label1.Height
Label2.AutoSize = True
Label2.Caption = "Output level"
ProgressBar1.Move Label1.Width * 2, 0, 3375
ProgressBar2.Move Label1.Width * 2, Label2.Top, 3375
Check1.Move ProgressBar1.Left, ProgressBar1.Height
Check1.Caption = "Get Input"
Me.Move Me.Left, Me.Top, ProgressBar1.Width + ProgressBar1.Left + 10 * Screen.TwipsPerPixelX, ProgressBar2.Top + ProgressBar2.Height + 30 * Screen.TwipsPerPixelY
Timer1.Interval = 50
Timer1.Enabled = True
' Open the mixer specified by DEVICEID
rc = mixerOpen(hmixer, DEVICEID, 0, 0, 0)
If ((MMSYSERR_NOERROR <> rc)) Then
MsgBox "Couldn't open the mixer."
Exit Sub
End If
' Get the input volume meter
ok = GetControl(hmixer, MIXERLINE_COMPONENTTYPE_DST_WAVEIN, MIXERCONTROL_CONTROLTYPE_PEAKMETER, inputVolCtrl)
If (ok <> True) Then
ok = GetControl(hmixer, MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE, MIXERCONTROL_CONTROLTYPE_PEAKMETER, inputVolCtrl)
End If
If (ok = True) Then
ProgressBar1.Min = 0
ProgressBar1.Max = inputVolCtrl.lMaximum
Else
ProgressBar1.Enabled = False
MsgBox "Couldn't get wavein meter"
End If
' Get the output volume meter
ok = GetControl(hmixer, MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT, MIXERCONTROL_CONTROLTYPE_PEAKMETER, outputVolCtrl)
If (ok = True) Then
ProgressBar2.Min = 0
ProgressBar2.Max = outputVolCtrl.lMaximum
Else
ProgressBar2.Enabled = False
MsgBox "Couldn't get waveout meter"
End If
' Initialize mixercontrol structure
mxcd.cbStruct = Len(mxcd)
volHmem = GlobalAlloc(&H0, Len(volume)) ' Allocate a buffer for the volume value
mxcd.paDetails = GlobalLock(volHmem)
mxcd.cbDetails = Len(volume)
mxcd.cChannels = 1
End Sub
Private Sub Check1_Click()
If (Check1.Value = 1) Then
StartInput ' Start receiving audio input
Else
StopInput ' Stop receiving audio input
End If
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
' Process sound buffer if recording
If (fRecording) Then
For i = 0 To (NUM_BUFFERS - 1)
If inHdr(i).dwFlags And WHDR_DONE Then
rc = waveInAddBuffer(hWaveIn, inHdr(i), Len(inHdr(i)))
End If
Next
End If
' Get the current input level
If (ProgressBar1.Enabled = True) Then
mxcd.dwControlID = inputVolCtrl.dwControlID
mxcd.item = inputVolCtrl.cMultipleItems
rc = mixerGetControlDetails(hmixer, mxcd, MIXER_GETCONTROLDETAILSF_VALUE)
CopyStructFromPtr volume, mxcd.paDetails, Len(volume)
If (volume < 0) Then
volume = -volume
End If
ProgressBar1.Value = volume
End If
' Get the current output level
If (ProgressBar2.Enabled = True) Then
mxcd.dwControlID = outputVolCtrl.dwControlID
mxcd.item = outputVolCtrl.cMultipleItems
rc = mixerGetControlDetails(hmixer, mxcd, MIXER_GETCONTROLDETAILSF_VALUE)
CopyStructFromPtr volume, mxcd.paDetails, Len(volume)
If (volume < 0) Then volume = -volume
ProgressBar2.Value = volume
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
If (fRecording = True) Then
StopInput
End If
GlobalFree volHmem
End Sub
'Paste this code into the module
Public Const CALLBACK_FUNCTION = &H30000
Public Const MM_WIM_DATA = &H3C0
Public Const WHDR_DONE = &H1 ' done bit
Public Const GMEM_FIXED = &H0 ' Global Memory Flag used by GlobalAlloc functin
Type WAVEHDR
lpData As Long
dwBufferLength As Long
dwBytesRecorded As Long
dwUser As Long
dwFlags As Long
dwLoops As Long
lpNext As Long
Reserved As Long
End Type
Type WAVEINCAPS
wMid As Integer
wPid As Integer
vDriverVersion As Long
szPname As String * 32
dwFormats As Long
wChannels As Integer
End Type
Type WAVEFORMAT
wFormatTag As Integer
nChannels As Integer
nSamplesPerSec As Long
nAvgBytesPerSec As Long
nBlockAlign As Integer
wBitsPerSample As Integer
cbSize As Integer
End Type
Declare Function waveInOpen Lib "winmm.dll" (lphWaveIn As Long, ByVal uDeviceID As Long, lpFormat As WAVEFORMAT, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long
Declare Function waveInPrepareHeader Lib "winmm.dll" (ByVal hWaveIn As Long, lpWaveInHdr As WAVEHDR, ByVal uSize As Long) As Long
Declare Function waveInReset Lib "winmm.dll" (ByVal hWaveIn As Long) As Long
Declare Function waveInStart Lib "winmm.dll" (ByVal hWaveIn As Long) As Long
Declare Function waveInStop Lib "winmm.dll" (ByVal hWaveIn As Long) As Long
Declare Function waveInUnprepareHeader Lib "winmm.dll" (ByVal hWaveIn As Long, lpWaveInHdr As WAVEHDR, ByVal uSize As Long) As Long
Declare Function waveInClose Lib "winmm.dll" (ByVal hWaveIn As Long) As Long
Declare Function waveInGetDevCaps Lib "winmm.dll" Alias "waveInGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As WAVEINCAPS, ByVal uSize As Long) As Long
Declare Function waveInGetNumDevs Lib "winmm.dll" () As Long
Declare Function waveInGetErrorText Lib "winmm.dll" Alias "waveInGetErrorTextA" (ByVal err As Long, ByVal lpText As String, ByVal uSize As Long) As Long
Declare Function waveInAddBuffer Lib "winmm.dll" (ByVal hWaveIn As Long, lpWaveInHdr As WAVEHDR, ByVal uSize As Long) As Long
Public Const MMSYSERR_NOERROR = 0
Public Const MAXPNAMELEN = 32
Public Const MIXER_LONG_NAME_CHARS = 64
Public Const MIXER_SHORT_NAME_CHARS = 16
Public Const MIXER_GETLINEINFOF_COMPONENTTYPE = &H3&
Public Const MIXER_GETCONTROLDETAILSF_VALUE = &H0&
Public Const MIXER_GETLINECONTROLSF_ONEBYTYPE = &H2&
Public Const MIXERLINE_COMPONENTTYPE_DST_FIRST = &H0&
Public Const MIXERLINE_COMPONENTTYPE_SRC_FIRST = &H1000&
Public Const MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 4)
Public Const MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3)
Public Const MIXERLINE_COMPONENTTYPE_SRC_LINE = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2)
Public Const MIXERCONTROL_CT_CLASS_FADER = &H50000000
Public Const MIXERCONTROL_CT_UNITS_UNSIGNED = &H30000
Public Const MIXERCONTROL_CT_UNITS_SIGNED = &H20000
Public Const MIXERCONTROL_CT_CLASS_METER = &H10000000
Public Const MIXERCONTROL_CT_SC_METER_POLLED = &H0&
Public Const MIXERCONTROL_CONTROLTYPE_FADER = (MIXERCONTROL_CT_CLASS_FADER Or MIXERCONTROL_CT_UNITS_UNSIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_VOLUME = (MIXERCONTROL_CONTROLTYPE_FADER + 1)
Public Const MIXERLINE_COMPONENTTYPE_DST_WAVEIN = (MIXERLINE_COMPONENTTYPE_DST_FIRST + 7)
Public Const MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT = (MIXERLINE_COMPONENTTYPE_SRC_FIRST + 8)
Public Const MIXERCONTROL_CONTROLTYPE_SIGNEDMETER = (MIXERCONTROL_CT_CLASS_METER Or MIXERCONTROL_CT_SC_METER_POLLED Or MIXERCONTROL_CT_UNITS_SIGNED)
Public Const MIXERCONTROL_CONTROLTYPE_PEAKMETER = (MIXERCONTROL_CONTROLTYPE_SIGNEDMETER + 1)
Declare Function mixerClose Lib "winmm.dll" (ByVal hmx As Long) As Long
Declare Function mixerGetControlDetails Lib "winmm.dll" Alias "mixerGetControlDetailsA" (ByVal hmxobj As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As Long
Declare Function mixerGetDevCaps Lib "winmm.dll" Alias "mixerGetDevCapsA" (ByVal uMxId As Long, ByVal pmxcaps As MIXERCAPS, ByVal cbmxcaps As Long) As Long
Declare Function mixerGetID Lib "winmm.dll" (ByVal hmxobj As Long, pumxID As Long, ByVal fdwId As Long) As Long
Declare Function mixerGetLineInfo Lib "winmm.dll" Alias "mixerGetLineInfoA" (ByVal hmxobj As Long, pmxl As MIXERLINE, ByVal fdwInfo As Long) As Long
Declare Function mixerGetLineControls Lib "winmm.dll" Alias "mixerGetLineControlsA" (ByVal hmxobj As Long, pmxlc As MIXERLINECONTROLS, ByVal fdwControls As Long) As Long
Declare Function mixerGetNumDevs Lib "winmm.dll" () As Long
Declare Function mixerMessage Lib "winmm.dll" (ByVal hmx As Long, ByVal uMsg As Long, ByVal dwParam1 As Long, ByVal dwParam2 As Long) As Long
Declare Function mixerOpen Lib "winmm.dll" (phmx As Long, ByVal uMxId As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal fdwOpen As Long) As Long
Declare Function mixerSetControlDetails Lib "winmm.dll" (ByVal hmxobj As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As Long
Declare Sub CopyStructFromPtr Lib "kernel32" Alias "RtlMoveMemory" (struct As Any, ByVal ptr As Long, ByVal cb As Long)
Declare Sub CopyPtrFromStruct Lib "kernel32" Alias "RtlMoveMemory" (ByVal ptr As Long, struct As Any, ByVal cb As Long)
Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long, ByVal dwBytes As Long) As Long
Declare Function GlobalLock Lib "kernel32" (ByVal hmem As Long) As Long
Declare Function GlobalFree Lib "kernel32" (ByVal hmem As Long) As Long
Type MIXERCAPS
wMid As Integer
wPid As Integer
vDriverVersion As Long
szPname As String * MAXPNAMELEN
fdwSupport As Long
cDestinations As Long
End Type
Type MIXERCONTROL
cbStruct As Long
dwControlID As Long
dwControlType As Long
fdwControl As Long
cMultipleItems As Long
szShortName As String * MIXER_SHORT_NAME_CHARS
szName As String * MIXER_LONG_NAME_CHARS
lMinimum As Long
lMaximum As Long
Reserved(10) As Long
End Type
Type MIXERCONTROLDETAILS
cbStruct As Long
dwControlID As Long
cChannels As Long
item As Long
cbDetails As Long
paDetails As Long
End Type
Type MIXERCONTROLDETAILS_SIGNED
lValue As Long
End Type
Type MIXERLINE
cbStruct As Long
dwDestination As Long
dwSource As Long
dwLineID As Long
fdwLine As Long
dwUser As Long
dwComponentType As Long
cChannels As Long
cConnections As Long
cControls As Long
szShortName As String * MIXER_SHORT_NAME_CHARS
szName As String * MIXER_LONG_NAME_CHARS
dwType As Long
dwDeviceID As Long
wMid As Integer
wPid As Integer
vDriverVersion As Long
szPname As String * MAXPNAMELEN
End Type
Type MIXERLINECONTROLS
cbStruct As Long
dwLineID As Long
dwControl As Long
cControls As Long
cbmxctrl As Long
pamxctrl As Long
End Type
Public i As Integer, j As Integer, rc As Long, msg As String * 200, hWaveIn As Long
Public Const NUM_BUFFERS = 2
Public format As WAVEFORMAT, hmem(NUM_BUFFERS) As Long, inHdr(NUM_BUFFERS) As WAVEHDR
Public Const BUFFER_SIZE = 8192
Public Const DEVICEID = 0
Public fRecording As Boolean
Function GetControl(ByVal hmixer As Long, ByVal componentType As Long, ByVal ctrlType As Long, ByRef mxc As MIXERCONTROL) As Boolean
' This function attempts to obtain a mixer control. Returns True if successful.
Dim mxlc As MIXERLINECONTROLS
Dim mxl As MIXERLINE
Dim hmem As Long
Dim rc As Long
mxl.cbStruct = Len(mxl)
mxl.dwComponentType = componentType
' Obtain a line corresponding to the component type
rc = mixerGetLineInfo(hmixer, mxl, MIXER_GETLINEINFOF_COMPONENTTYPE)
If (MMSYSERR_NOERROR = rc) Then
mxlc.cbStruct = Len(mxlc)
mxlc.dwLineID = mxl.dwLineID
mxlc.dwControl = ctrlType
mxlc.cControls = 1
mxlc.cbmxctrl = Len(mxc)
' Allocate a buffer for the control
'hmem = GlobalAlloc(&H40, Len(mxc))
hmem = GlobalAlloc(GMEM_FIXED, Len(mxc))
mxlc.pamxctrl = GlobalLock(hmem)
mxc.cbStruct = Len(mxc)
' Get the control
rc = mixerGetLineControls(hmixer, mxlc, MIXER_GETLINECONTROLSF_ONEBYTYPE)
If (MMSYSERR_NOERROR = rc) Then
GetControl = True
' Copy the control into the destination structure
CopyStructFromPtr mxc, mxlc.pamxctrl, Len(mxc)
Else
GetControl = False
End If
GlobalFree (hmem)
Exit Function
End If
GetControl = False
End Function
' Function to process the wave recording notifications.
Sub waveInProc(ByVal hwi As Long, ByVal uMsg As Long, ByVal dwInstance As Long, ByRef hdr As WAVEHDR, ByVal dwParam2 As Long)
If (uMsg = MM_WIM_DATA) Then
If fRecording Then
rc = waveInAddBuffer(hwi, hdr, Len(hdr))
End If
End If
End Sub
' This function starts recording from the soundcard. The soundcard must be recording in order to
' monitor the input level. Without starting the recording from this application, input level
' can still be monitored if another application is recording audio
Function StartInput() As Boolean
If fRecording Then
StartInput = True
Exit Function
End If
format.wFormatTag = 1
format.nChannels = 1
format.wBitsPerSample = 8
format.nSamplesPerSec = 8000
format.nBlockAlign = format.nChannels * format.wBitsPerSample / 8
format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign
format.cbSize = 0
For i = 0 To NUM_BUFFERS - 1
hmem(i) = GlobalAlloc(&H40, BUFFER_SIZE)
inHdr(i).lpData = GlobalLock(hmem(i))
inHdr(i).dwBufferLength = BUFFER_SIZE
inHdr(i).dwFlags = 0
inHdr(i).dwLoops = 0
Next
rc = waveInOpen(hWaveIn, DEVICEID, format, 0, 0, 0)
If rc <> 0 Then
waveInGetErrorText rc, msg, Len(msg)
MsgBox msg
StartInput = False
Exit Function
End If
For i = 0 To NUM_BUFFERS - 1
rc = waveInPrepareHeader(hWaveIn, inHdr(i), Len(inHdr(i)))
If (rc <> 0) Then
waveInGetErrorText rc, msg, Len(msg)
MsgBox msg
End If
Next
For i = 0 To NUM_BUFFERS - 1
rc = waveInAddBuffer(hWaveIn, inHdr(i), Len(inHdr(i)))
If (rc <> 0) Then
waveInGetErrorText rc, msg, Len(msg)
MsgBox msg
End If
Next
fRecording = True
rc = waveInStart(hWaveIn)
StartInput = True
End Function
' Stop receiving audio input on the soundcard
Sub StopInput()
fRecording = False
waveInReset hWaveIn
waveInStop hWaveIn
For i = 0 To NUM_BUFFERS - 1
waveInUnprepareHeader hWaveIn, inHdr(i), Len(inHdr(i))
GlobalFree hmem(i)
Next
waveInClose hWaveIn
End Sub
Error if using winmm.dll, kernel32 in x64 mode -
OraOLEDB.Oracle Provider Not Found- Windows 7 64 bit Excel 2010 32-bit Help
Currently, I have an excel 2010 application that users on Windows XP 32 bit are using to connect to an Oracle 32-bit database and extract data back into Excel. Each time they open the Excel file, the VBA code automatically creates a new connection using Provider =ORA.OLEDB.Oracle Provider. All users using the Excel file have installed Oracle 9.2.1 run-time client on their machine. All of that works well currently for over 100+ users on Windows XP 32-bit
Starting very shortly our company is moving to Windows 7 64-bit. We acquired a test PC with Windows 7 64-bit and Excel 2010 32-bit. We tried to install Oracle 9.0.2 run-time client but we couldn't connect to the database ( even with Sql Plus). We therefore downloaded Oracle 10g 10.2.04 Run-time client. With this installed, we were able to connect to via SQL Plus to the database. However, using the same Excel file and the following same VBA code.
Set cn = New ADODB.Connection
cn.Open ThisWorkbook.getDBCon()
Public Function getDBCon()
getDBCon = "Provider=OraOLEDB.Oracle;" & _
"Data Source=MyOracleDB;" & _
"User Id=" & getDBUser() & ";Password=" & getDBPss()
End Function
I get a "Provider Not Found error". The VBA code and file work perfect in XP 32-bit. It seems going over to Windows 64-bit has caused issues with the file's macro. I am looking for help assessing if I have more of an Oracle Client issue or a Microsoft ADO issue. Any input would be greatly appreciated. Thank You.@damorgan
Yea agreed with Excel to Oracle comment. This is due to issues with global implementation of an ERP system and the disconnets between IT and Business. Therefore the business intelligence tables in oracle are most easily pulled and acted on by novice PC users via Excel. In the business, Excel is the standard tool novice non-IT people feel comfortable in to share and act on data. Most of these users have no IT knowledge whatsoever, so we create buttons and filters for them to query and then massage in Excel as they see fit.
Having said that, still wondering if it's a ADO or Oracle Client issue. This is something beyond my knowledge. I wouldn't imagine it's the Visual Basic issue since this same file works in Windows XP. I am not in the position to just scrap Excel as the business relies on this in production and I am the only support. What could 64 bit vs 32 bit differences be having here? Thank You.
Maybe you are looking for
-
I uploaded a couple of video files from my Droid X to my computer. They have and extension of .3gp. None of my players will recognize them. Can anyone help with this?
-
Paragraphs do not align to grid
Hello there:-) I created a baseline grid of 6pt, body text 12pt, head lead 12pt, space before and space after 12pt and 6pt. In one chapter, everything aligns, in the second one the paragraphs do not align. I'm going back and forth the paragraph style
-
Why Bean does not ????
Hi, please clerify me why does Bean class does not implement remote interface. Raj
-
Kernel panic after Lion com.apple.NVDAResman
I never had any problems before my install of Lion, but now - from time to time - I am getting a kernel panic. The backtrace is Kernel Extensions in Backtrace: com.apple.NVDAResman Everything else is exactly the same as it was. Anyone have an ideas
-
Directory Association Questions
I'm planning on upgrading my GW2012 server to 2014 this coming weekend and am in the final stages of working in my testing environment. My upgrade is going successful but I'm having a couple of behavioral questions in regards to the Directory Associa