Manipulating ShockwaveFlash in Excel Using VBA
I am trying to change various variables in an embedded shockwaveplayer but I cannot get the video to play through code. My code is below. Any help would be appreciated and thanks in advance.
Sub TestVideo()
On Error GoTo iErrors
Set appxl = Excel.Application
Set sht = appxl.ActiveSheet
Dim shFl As ShockwaveFlash
For Each obj In sht.OLEObjects
If InStr(obj.progID, "ShockwaveFlash") > 0 Then
Set shFl = obj.Object
shFl.LoadMovie 0, shFl.Movie 'http://www.youtube.com/watch?v=1YuH8IoqaAg&feature=feedrec_grec_index
Exit For
End If
Next
Exit Sub
iErrors:
Err.Clear
Resume Next
End Sub
Thanks again
Hi Mr.Thomas,
Based on my understanding, the suggestion using Regular Expressions is a very helpful. Have you fixed the issue now?
If you still have the issue about develop with Regular Expressions using VBA, I suggest that you reopen a new thread in
Visual Basic for Application forum.
Regards & Fei
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.
Similar Messages
-
Export Project Tasks to Excel using VBA by Custom Field
Question referring to the link:
http://social.technet.microsoft.com/Forums/projectserver/en-US/9c46458c-893f-41ba-bd46-bdb59c533f4a/export-project-tasks-to-excel-using-vba-by-custom-field?forum=project2010custprog
Help needed. I have inserted my question at this address for Andrew or anybody else to reply. Hope to hear from you.
Regards,
ChuckThank you Andrew for getting back to me and I have found somewhere on the net the following macro that would do the job for the version 2007. Here is a copy for those that may need it.
Option Explicit
Sub CreateMenus()
Dim cbrMain As CommandBar
Dim ctlMain As CommandBarControl
Dim ctlOLExport1 As CommandBarControl
Dim ctlOLExport2 As CommandBarControl
Dim ctlOLExport3 As CommandBarControl
Set cbrMain = Application.CommandBars.ActiveMenuBar
Set ctlMain = cbrMain.Controls.Add(Type:=msoControlPopup, Temporary:=True)
ctlMain.Caption = "Export to Outlook"
Set ctlOLExport1 = ctlMain.CommandBar.Controls.Add(Type:=msoControlButton)
With ctlOLExport1
.Caption = "Selection to Outlook tasks"
.OnAction = "Macro """ & "Export_Selection_To_OL_Tasks"""
End With
Set ctlOLExport2 = ctlMain.CommandBar.Controls.Add(Type:=msoControlButton)
With ctlOLExport2
.Caption = "Selection to Outlook appointments"
.OnAction = "Macro """ & "Export_Selection_To_OL_Appointments"""
End With
Set ctlOLExport3 = ctlMain.CommandBar.Controls.Add(Type:=msoControlButton)
With ctlOLExport3
.Caption = "Selection to Outlook notes"
.OnAction = "Macro """ & "Export_Selection_To_OL_Notes"""
End With
End Sub
Cheers!
Chuck -
I would like to execute an existing BW report from Excel (using VBA).
I would like to execute an existing BW report from Excel (using VBA) and download the results into Excel. I understand that there is an Excel Add-In which (I believe) should allow me to do this. I am an experienced user of Excel / VBA but I have virtually no experience with SAP. If someone could point me to any source of information or specific instructions I would be extremely appreciative. I've done multiple searches on the internet but everything I find seems to assume more knowledge of SAP and SAP acronyms than I possess.
Paul,
If your company (or your client's company) has an SAP license (I assume this is the case, since there would be no other reason for you to want to access an SAP system using Excel), there is a person in your company who can request an ID for you. It is called a SAP Service Marketplace userid, more commonly called an 'S' number. This person in your company is usually a Basis Administrator. Go to your SAP Basis team and ask them for access to Service Marketplace.
The common solution for your Excel analysis problem is to install the Bex Analyzer on your PC. You will need these same guys (Basis Team) to help you with getting the required SAP access, and to install the associated SAP software onto your PC.
In the meantime, here is some bedtime reading for you.
Analysis & Reporting: BEx Analyzer - Business Intelligence - SAP Library
Best Regards,
DB49 -
BAPI Access from Excel using VBA
Im writing an excel macro (VBA) to call a bapi that populates a spreadsheet.
The user will then do some manipulation of the data collected, and then it must be sent back to sap.
The Bapi in question is BAPI_GET_USER_DETAIL
*" IMPORTING
*" VALUE(USERNAME) LIKE BAPIBNAME-BAPIBNAME
*" EXPORTING
*" VALUE(LOGONDATA) LIKE BAPILOGOND STRUCTURE BAPILOGOND
*" VALUE(DEFAULTS) LIKE BAPIDEFAUL STRUCTURE BAPIDEFAUL
*" VALUE(ADDRESS) LIKE BAPIADDR3 STRUCTURE BAPIADDR3
*" VALUE(COMPANY) LIKE BAPIUSCOMP STRUCTURE BAPIUSCOMP
*" VALUE(SNC) LIKE BAPISNCU STRUCTURE BAPISNCU
*" VALUE(REF_USER) LIKE BAPIREFUS STRUCTURE BAPIREFUS
*" VALUE(ALIAS) LIKE BAPIALIAS STRUCTURE BAPIALIAS
*" TABLES
*" PARAMETER STRUCTURE BAPIPARAM OPTIONAL
*" PROFILES STRUCTURE BAPIPROF OPTIONAL
*" ACTIVITYGROUPS STRUCTURE BAPIAGR OPTIONAL
*" RETURN STRUCTURE BAPIRET2
*" ADDTEL STRUCTURE BAPIADTEL OPTIONAL
*" ADDFAX STRUCTURE BAPIADFAX OPTIONAL
*" ADDTTX STRUCTURE BAPIADTTX OPTIONAL
*" ADDTLX STRUCTURE BAPIADTLX OPTIONAL
*" ADDSMTP STRUCTURE BAPIADSMTP OPTIONAL
*" ADDRML STRUCTURE BAPIADRML OPTIONAL
*" ADDX400 STRUCTURE BAPIADX400 OPTIONAL
*" ADDRFC STRUCTURE BAPIADRFC OPTIONAL
*" ADDPRT STRUCTURE BAPIADPRT OPTIONAL
*" ADDSSF STRUCTURE BAPIADSSF OPTIONAL
*" ADDURI STRUCTURE BAPIADURI OPTIONAL
*" ADDPAG STRUCTURE BAPIADPAG OPTIONAL
*" ADDCOMREM STRUCTURE BAPICOMREM OPTIONAL
*" GROUPS STRUCTURE BAPIGROUPS OPTIONAL
Ive Managed to glean from various sources on the internet, the various basics on doing a bapi call from VBA
Here is what i have so far.
Private Sub Fetch_User_details_Click()
'Take username in cell 2,2 and check to see it it exists.
'Display the First and Last name of the user
'Get list of all roles and their expiry dates and populate list
Dim R3, MyFunc, App As Object
Dim SEL_TAB, NAMETAB, TABENTRY, ROW As Object
Dim Result As Boolean
Dim iRow, iColumn, iStart, iStartRow As Integer
'RFC Paramaters
Dim Pusername As Variant
Dim Preturn As Variant
Dim copyFromc As String
'Clear Table Section of Spreadsheet
Worksheets("Sheet1").Select
For x = 9 To 200
For y = 1 To 8
Worksheets("Sheet1").Cells(x, y).ClearContents
Next y
Next x
'Create Server object and Setup the connection
Set R3 = CreateObject("SAP.Functions")
R3.Connection.System = ""
R3.Connection.client = ""
R3.Connection.user = ""
R3.Connection.Password = ""
R3.Connection.Language = "EN"
'Logon to SAP
If R3.Connection.logon(0, False) <> True Then
Exit Sub
End If
'R3.loglevel = 9
'R3.logfilename = "c:guilog.txt"
Set MyFunc = R3.Add("BAPI_USER_GET_DETAIL")
copyFromc = Worksheets("Sheet1").Cells(3, 2).Text
Set Pusername = MyFunc.exports("USERNAME")
Pusername.Value = copyFromc
'Call the BAPI
If MyFunc.call Then
' ok now what ?
' Process the returned data into the spreadsheet
Else
MsgBox ("Call returned FALSE")
End If
'Close Connection to SAP
R3.Connection.logoff
End Sub
To update the data ( User Role Assignements ) i will be using bapi BAPI_USER_ACTGROUPS_ASSIGN
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(USERNAME) LIKE BAPIBNAME-BAPIBNAME
*" TABLES
*" ACTIVITYGROUPS STRUCTURE BAPIAGR
*" RETURN STRUCTURE BAPIRET2
* Dieser Baustein ist gleichgestellt mit der Pflege eines Benutzers
* über die Pflegetransaktion, gepflegt werden die Felder, für die die
* Pflege erlaubt ist
I need help deciphering the data received from the bapi and then repackaging it using VBA.
I know writing this in ABAP would take less than 30 mins, but that is not an option for me.Ok, Ive made some headway
I can now Read all the data i need from SAP
Now comes the bit to write it back again. Will Update when i have a solution
Private Sub copydata_Click()
Dim x1 As Integer, x2 As Integer
'copy all data from "Copy From" to "Copy To"
'first determine how many rows contain roles
'before copying the roles, check that the destination user has no roles assigned
If Cells(9, 6).Text <> "" Then
MsgBox ("Error. Destination User already has Roles assigned.")
Exit Sub
End If
For x1 = 0 To 1000
If Cells(9 + x1, 1).Text = "" Then
Exit For
End If
Next
Worksheets("Sheet1").Range(Cells(9, 1), Cells(9 + x1 - 1, 4)).Copy _
Destination:=Worksheets("Sheet1").Range(Cells(9, 6), Cells(9 + x1, 9))
For x2 = 1 To x1
Worksheets("Sheet1").Cells(9 + x2 - 1, 8).Value = Date
Next
End Sub
Sub Mail_small_Text_Outlook()
' Is working in Office 2000-2007
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
strbody = "User " & Worksheets("Sheet1").Cells(3, 7).Text & _
" Has Been Moddelled off of User " & _
Worksheets("Sheet1").Cells(3, 2).Text & " in system " & _
Worksheets("Connection").Cells(1, 2).Text & vbNewLine & vbNewLine & _
"Please Adjust Mitigating Controls Accordingly"
On Error Resume Next
With OutMail
.To = Worksheets("Connection").Cells(10, 2).Text
.CC = ""
.BCC = ""
.Subject = "User Modelled"
.Body = strbody
.Send 'or use .Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Private Sub Fetch_CopyTo_User_Click()
'Take username in cell 3,7 and check to see it it exists.
'Display the First and Last name of the user
'Get list of all roles and their expiry dates and populate list
Dim R3, MyFunc, App As Object
Dim SEL_TAB, NAMETAB, TABENTRY, ROW As Object
Dim Result As Boolean
Dim iRow, iColumn, iStart, iStartRow As Integer
'RFC Paramaters
Dim Pusername As Object
Dim PAddress As Object
Dim PTable As Object
Dim Preturn As Object
Dim copyFromc As String
'Clear Table Section of Spreadsheet
Worksheets("Sheet1").Cells(5, 8).ClearContents
Worksheets("Sheet1").Cells(6, 8).ClearContents
'Create Server object and Setup the connection
Set R3 = CreateObject("SAP.Functions")
R3.Connection.System = Worksheets("Connection").Cells(1, 2).Text
R3.Connection.SystemNumber = Worksheets("Connection").Cells(2, 2).Text
R3.Connection.Destination = Worksheets("Connection").Cells(3, 2).Text
R3.Connection.HostName = Worksheets("Connection").Cells(4, 2).Text
R3.Connection.client = Worksheets("Connection").Cells(5, 2).Text
R3.Connection.user = Worksheets("Connection").Cells(6, 2).Text
R3.Connection.Password = Worksheets("Connection").Cells(7, 2).Text
R3.Connection.Language = Worksheets("Connection").Cells(8, 2).Text
'Logon to SAP
If R3.Connection.Logon(0, -1) <> True Then
MsgBox ("We Had a Logon Error")
Exit Sub
End If
'R3.loglevel = 9
'R3.logfilename = "c:\guilog.txt"
Set MyFunc = R3.Add("BAPI_USER_GET_DETAIL")
Set Pusername = MyFunc.exports("USERNAME")
Set PAddress = MyFunc.imports("ADDRESS")
Set Preturn = MyFunc.tables("RETURN")
Set PTable = MyFunc.tables("ACTIVITYGROUPS")
Pusername.Value = Worksheets("Sheet1").Cells(3, 7).Text
'Call the BAPI
If MyFunc.call Then
Dim xxx As String
Worksheets("Sheet1").Cells(5, 7).Value = PAddress.Value("FIRSTNAME")
Worksheets("Sheet1").Cells(6, 7).Value = PAddress.Value("LASTNAME")
'Get Assigned Roles
Dim datarec As Object
Dim datafld As Object
x = 9
For Each datarec In PTable.Rows
Worksheets("Sheet1").Cells(x, 6).Value = datarec("AGR_NAME")
Worksheets("Sheet1").Cells(x, 7).Value = datarec("AGR_TEXT")
Worksheets("Sheet1").Cells(x, 8).Value = datarec("FROM_DAT")
Worksheets("Sheet1").Cells(x, 9).Value = datarec("TO_DAT")
x = x + 1
Next
copydata.Enabled = True
Else
MsgBox ("Error Calling Function - Probably Authorizations")
End If
'Close Connection to SAP
R3.Connection.logoff
End Sub
Private Sub Fetch_User_details_Click()
'Take username in cell 3,2 and check to see it it exists.
'Display the First and Last name of the user
'Get list of all roles and their expiry dates and populate list
Dim R3, MyFunc, App As Object
Dim SEL_TAB, NAMETAB, TABENTRY, ROW As Object
Dim Result As Boolean
Dim iRow, iColumn, iStart, iStartRow As Integer
'RFC Paramaters
Dim Pusername As Object
Dim PAddress As Object
Dim PTable As Object
Dim Preturn As Object
Dim copyFromc As String
'Clear Table Section and other areas of Spreadsheet
Worksheets("Sheet1").Select
For x = 9 To 1000
For y = 1 To 9
Worksheets("Sheet1").Cells(x, y).ClearContents
Next y
Next x
Worksheets("Sheet1").Cells(5, 2).ClearContents
Worksheets("Sheet1").Cells(6, 2).ClearContents
Worksheets("Sheet1").Cells(5, 7).ClearContents
Worksheets("Sheet1").Cells(6, 7).ClearContents
copydata.Enabled = False
'Create Server object and Setup the connection
Set R3 = CreateObject("SAP.Functions")
R3.Connection.System = Worksheets("Connection").Cells(1, 2).Text
R3.Connection.SystemNumber = Worksheets("Connection").Cells(2, 2).Text
R3.Connection.Destination = Worksheets("Connection").Cells(3, 2).Text
R3.Connection.HostName = Worksheets("Connection").Cells(4, 2).Text
R3.Connection.client = Worksheets("Connection").Cells(5, 2).Text
R3.Connection.user = Worksheets("Connection").Cells(6, 2).Text
R3.Connection.Password = Worksheets("Connection").Cells(7, 2).Text
R3.Connection.Language = Worksheets("Connection").Cells(8, 2).Text
'Logon to SAP
If R3.Connection.Logon(0, -1) <> True Then
MsgBox ("We Had a Logon Error")
Exit Sub
End If
'R3.loglevel = 9
'R3.logfilename = "c:\guilog.txt"
Set MyFunc = R3.Add("BAPI_USER_GET_DETAIL")
Set Pusername = MyFunc.exports("USERNAME")
Set PAddress = MyFunc.imports("ADDRESS")
Set Preturn = MyFunc.tables("RETURN")
Set PTable = MyFunc.tables("ACTIVITYGROUPS")
Pusername.Value = Worksheets("Sheet1").Cells(3, 2).Text
'Call the BAPI
If MyFunc.call Then
Dim xxx As String
Worksheets("Sheet1").Cells(5, 2).Value = PAddress.Value("FIRSTNAME")
Worksheets("Sheet1").Cells(6, 2).Value = PAddress.Value("LASTNAME")
'Get Assigned Roles
Dim datarec As Object
Dim datafld As Object
x = 9
For Each datarec In PTable.Rows
Worksheets("Sheet1").Cells(x, 1).Value = datarec("AGR_NAME")
Worksheets("Sheet1").Cells(x, 2).Value = datarec("AGR_TEXT")
Worksheets("Sheet1").Cells(x, 3).Value = datarec("FROM_DAT")
Worksheets("Sheet1").Cells(x, 4).Value = datarec("TO_DAT")
x = x + 1
Next
Else
MsgBox ("Error Calling Function - Probably Authorizations")
End If
'Close Connection to SAP
R3.Connection.logoff
End Sub
Private Sub UpdateSap_Click()
End Sub -
How can I export multiple PDF fillable forms into a spreadsheet (Excel) using VBA?
Hi guys,
I never used VBA with with Adobe Acrobat. I would like a tip to start doing that. What I would like to do know is:
1 - I have multiple PDF Forms that are filled.
2 - I want all the data from those forms to be exported to Excel via VBA code.
3 - Adobe Acrobat already have an option to do that manually (Forms > Merge Data Files Into Spreadsheet) and it works perfectly.
4 - I would like to access that feature using VBA, then generate a spreadsheet.
Any tips? How can I start?
Thanks!A good place to start is Karl Heinz Kremer's blog, where he has a few examples:
http://khkonsulting.com/2010/09/reading-pdf-form-fields-with-vba/ -
I am trying to do an RFC call from Excel to SAP using VBA. RFC is working fine for most the RFC enabled Function Modules except DDIF_FIELDINFO_GET and DDIF_FIELDLABEL_GET.
What can be the reason for this?
Can someonme please help me with a macro code where these FMs are working.
Also can someone please help me with some tutorial on SAP connection with Excel.
<REMOVED BY MODERATOR - REQUEST OR OFFER POINTS ARE FORBIDDEN>
Edited by: Alvaro Tejada Galindo on Nov 12, 2008 9:14 AMHello Jon.
DDIF_FIELDINFO_GET is not working for me either. But I have used another FM (/ZOPTION/LIVE_DDIF_FIELDINFO):
Public Sub RFC_FIELDINFO()
Dim Func As Object
Dim sapConn As Object
Dim tblFIELDTAB
Dim tblFIXED_VALUES
Dim intRow%
Dim intCol%
'* Sub : Call FM /ZOPTION/LIVE_DDIF_FIELDINFO *
'* Author : Holger Köhn *
'* Created : 23.08.2014 *
'* Changed : *
ThisWorkbook.Sheets("TEST").Activate
Cells.Select
Selection.ClearContents
ThisWorkbook.Sheets("TEST").Range("A1").Select
'* create RFC-Connection *
Set sapConn = CreateObject("SAP.Functions")
sapConn.Connection.RfcWithDialog = True
If sapConn.Connection.LogOn(1, False) <> True Then
MsgBox "Cannot Logon to SAP"
Exit Sub
End If
DoEvents
'* run FM /ZOPTION/LIVE_DDIF_FIELDINFO *
Set Func = sapConn.Add("/ZOPTION/LIVE_DDIF_FIELDINFO")
Func.Exports("TABNAME") = "AUFK"
Set tblFIELDTAB = Func.Tables("FIELDTAB")
If Func.Call = False Then
MsgBox Func.Exception
Exit Sub
Else
Application.ScreenUpdating = False
For intCol = 1 To tblFIELDTAB.ColumnCount
ThisWorkbook.Sheets("TEST").Cells(1, intCol).Value = tblFIELDTAB.ColumnName(intCol)
Next
If tblFIELDTAB.RowCount > 0 Then
For intRow = 1 To tblFIELDTAB.RowCount
For intCol = 1 To tblFIELDTAB.ColumnCount
ThisWorkbook.Sheets("TEST").Cells((intRow + 1), intCol).Value = tblFIELDTAB(intRow, intCol)
Next
Next
ThisWorkbook.Sheets("TEST").Activate
End If
Columns.AutoFit
Application.ScreenUpdating = True
End If
'* clear tblFIELDTAB *
Do Until tblFIELDTAB.RowCount = 0
Call tblFIELDTAB.Rows.Remove(1)
Loop
Set sapConn = Nothing
Set Func = Nothing
Set tblFIELDTAB = Nothing
End Sub -
Manipulating subject in mail using VBA
Hi,
I have the need for a VBA code for Outlook, that will take the subject line, identify a casenumber XXXX123456, and put [] on the casenumber. For example:
Subjectline: Printerproblems XXXX123456
Subjectline: Printerproblems [XXXX123456]
(The casenumber can be anywhere in the subject line.)
Dim strSubject As String
strSubject = Item.Subject
strSubject = Replace(strSubject, "XXXX", "[XXXX")
Item.Subject = strSubject
But I can not find a way to write the last ]. Maybe I am doing this wrong, or something smarter exist.
Please help.
Best regards,
Mr. THi Mr.Thomas,
Based on my understanding, the suggestion using Regular Expressions is a very helpful. Have you fixed the issue now?
If you still have the issue about develop with Regular Expressions using VBA, I suggest that you reopen a new thread in
Visual Basic for Application forum.
Regards & Fei
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. -
Open Multiple PDFs from within excel using VBA
Hi,
I'm using excel 2010 and would like to open pdfs based on filenames I have listed in excel.
I attached a little of my code below which gives an idea of what I'm doing.
First question:
Is there a way to open mutiple files so that they are in one "instance" of adobe?
The way this currently works, is it opens up a whole new window for each file which can make desktop very cluttered.
Second question:
Our pdfs are actually in Sharepoint and so what I am first doing, is converting the URL to point to a mapped directory of the Sharepoint Site.
For this to work, the user must first map the sharepoint directory to a specific drive letter.
I'm wondering if there's a way to pass an actual URL via a shell command so I can skip the mapped drive bit? When I try it, it doesn't open the file.
Thanks!
My current vba:
'sFileName = full URL of the file in sharepoint
'Replace URL with Mapped Directory
sFileName = Replace(sFileName, "http://aamteams.alv.autoliv.int/sites/alvgmbu/", "A:\")
'Replace slashes in URL
sFileName = Replace(sFileName, "/", "\")
'Test if file exists before opening so adobe doesn't hang up on opening
If Dir(sFileName) = "" Then
A81_Try_Opening_In_Adobe = False
Exit Function
End If
l_strProg = GetDefaultProgram(sFileName)
'Execute function to open PDF
Shell l_strProg & " " & sFileName, vbNormalFocusHi Test,
We would like to open directly in adobe for the following reasons:
1. The users like opening our pdfs in adobe over browsers by a large margin.
2. If we use a mapped drive and adobe, you can see the filenames in the start bar which is important when you have multiple files.
If you open in browser (like we do today), you only see the left side of URL
Left side of URL is always the same so it does no good to see what file your in.
3. We have had issues where sometimes the pdfs open "blank" until I refresh the browser.
4. We are also looking for a way to make a local cache of most common files for faster loads.
But maybe I will give shell execute a try if it can find a local copy first in the code.
Then open in browser as last resort.
Using either shell or shell execute, is it possible to open multiple adobe files in the same instance or will we always have to get one instance for every pdf?
Thanks for the help! -
Post Author: shark70
CA Forum: Desktop Intelligence Reporting
Hi
The vba below saves a file into excel then does some formatting but I need to use the saveas function to set a password for the excel file when opening.
The code in bold is where I am getting stuck
Any ideas on where I'm gioing wrong, I'm fairly new to vba unfortunately
Cheers
Sub SetantaDSAT()
ActiveDocument.RefreshActiveDocument.SaveAs ("K:\CLIENTS (LIVE)\Setanta\08. New Daily Reports\DTT and DSAT Case Type Reports\2008\May 08\") & Format(Date, "ddmmyyyy") & "_" & " TestSetanta DTT Case Type_Subtype Analysis" & ".xls"
Set xlsApp = CreateObject("Excel.Application")xlsApp.Visible = TruexlsApp.Workbooks.Open ("K:\CLIENTS (LIVE)\Setanta\08. New Daily Reports\DTT and DSAT Case Type Reports\2008\May 08\") & Format(Date, "ddmmyyyy") & "_" & " TestSetanta DTT Case Type_Subtype Analysis" & ".xls"
With xlsApp.Worksheets("DSAT Case Type").Activate.ActiveWindow.DisplayGridlines = False.Columns("B:B").EntireColumn.AutoFit.Columns("C:C").EntireColumn.AutoFit.ActiveWindow.Zoom = 75.ActiveWorkbook.SaveAs Filename:="C:\James\Check\Book22.xls", _ FileFormat:=xlNormal, Password:="test", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=FalseEnd With
End Subone other thought is that you can create text files with a batch process inside of acrobat. Advanced ---> Document Processing ----> Batch Processing.
Choose new sequence, give it a name
Step 1: Select Commands ----> Choose "execute javascript", then hit "Add." Click on "Execute Javascript" that was just added on the right, then hit the edit button and toss in the script below that I grabbed from the javascript samples (also, if your docs have multiple pages you'll need to embed the for loop into another for loop that cycles through each page). You'd also want to change the name of the saved txt file to the name of pdf you're doing it to. It shouldn't be that hard, but I'm guessing you're probably alot more familiar with VBA then javascript which is why you're choosing to do it from excel. I'm kind of in the same boat of having written a bunch of VBA, but not much javascript. I highly recommend investing some time into learning acrobat scripting b/c VB does have it's limitations when it comes to messing with PDF's.
* function to extract the text content of the current page and save to a file.
try {
var p = this.pageNum;
var n = this.getPageNumWords(p);
app.alert("Number of words in the page: " + n);
var str = "";
for(var i=0;i<n;i++) {
var wd = this.getPageNthWord(p, i, false);
if(wd != "") str = str + wd;
// save the string into a data object
this.createDataObject("whatever.txt",str);
// pop up a file selection box to export the data
this.exportDataObject("whatever.txt");
// clean up
this.removeDataObject("whatever.txt");
} catch (e) {
app.alert(e) -
Importing Structure field values in Excel using VBA and SAP RFC
I am calling a RFC MEASUREM_DOCUM_RFC_SINGLE_001 from Excel VBA. The export parameters of the RFC has a parameter MEASUREMENT_DOCUMENT and structure COMPLETE_DOCUMENT. I am able to get back parameter value in excel from RFC using
ActiveCell = Funct.imports("MEASUREMENT_DOCUMENT")
Now I want to get the value of one of the fields say POINT of the structure COMPLETE_DOCUMENT in Excel. The following code doesnt work
ActiveCell = Funct.imports("COMPLETE_DOCUMENT-POINT")
It gives an error.
Even I have tried to using code for tables
dim tab as object
set tab = funct.tabels("COMPLETE_DOCUMENT")
but it did'nt work.
Can any one help me how to access the field value of a structure?
regards
RavindraI am calling a RFC MEASUREM_DOCUM_RFC_SINGLE_001 from Excel VBA. The export parameters of the RFC has a parameter MEASUREMENT_DOCUMENT and structure COMPLETE_DOCUMENT. I am able to get back parameter value in excel from RFC using
ActiveCell = Funct.imports("MEASUREMENT_DOCUMENT")
Now I want to get the value of one of the fields say POINT of the structure COMPLETE_DOCUMENT in Excel. The following code doesnt work
ActiveCell = Funct.imports("COMPLETE_DOCUMENT-POINT")
It gives an error.
Even I have tried to using code for tables
dim tab as object
set tab = funct.tabels("COMPLETE_DOCUMENT")
but it did'nt work.
Can any one help me how to access the field value of a structure?
regards
Ravindra -
Smart View Ribbon not shown when Excel is invoked using VBA
Dear Hyperion Gurus,
I am in need to invoke smartview refresh by calling excel using VBA from an excel module in another sheet(master template). But when I invloke Excel using VBA, smartview ribbon does not get activated, due to which the HypConnect, HypVMenuRefresh command does not work. If I directly open excel and run the module it connects fine and does the refresh without any problem. I have tried to enable and disable smartview using VBA but it does not work either. If I call excel directly using a batch using Call command, then it works fine, however the batch file does not close as if I use ThisWorkbook.Close command, then it does not completely close Excel, the instance still runs, and if I try to close using Application.Quit, then it closes down Excel completely. Any help would be highly appreciated.
Thanks and Regards,
SiddN.Hi,
I was able to achieve this using batch files by calling the excel templates one by one.
Thanks,
SiddN. -
I've got some tables in Access which I export to Excel using VBA. Once exported, I'd like to add some pivot tables, special formatting and formulas into the workbook. Any idea how to do this? Here are some specific tasks after the export:
1. Insert a pivot table into a 2nd sheet. The pivot table will have a filter field.
2. Format the column widths in that pivot table and add some conditional cell colors
Anybody know how to code this? I assume I'll need to export from access then open the excel file and use excel object model from within access?
ajwYou can certainly import Access tables into Excel:
http://www.erlandsendata.no/english/index.php?d=envbadacimportado
http://www.erlandsendata.no/english/index.php?d=envbadacimportdao
http://www.erlandsendata.no/english/index.php?d=envbadacrs2ws
See this too.
http://www.accessmvp.com/KDSnell/EXCEL_Export.htm#WriteRstFile
http://www.accessmvp.com/KDSnell/EXCEL_Export.htm#ExpCopyFromRst
That's just several similar, but slightly different, ways to do the same thing. Once your data is in Excel, turn on the Macro Recorder and run through the steps you need to do, to get the Pivot Table the way you want it, then turn off the Macro Recorder
and view the code.
You will almost certainly need to make some modifications to the recorded code, because everything will be fixed (hard-coded). Post back with additional questions, or start a new thread, to see how to make the next part(s) work. Just get comfortable
with the first part(s) for now.
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it. -
I wish to use VBA and Excel to programmatically open numbered Dreamweaver HTML (CS5) and find and replace text in the code view of these files, save and close them.
I have 5000 associations between Find: x0001 and Replace: y0001 in an Excel sheet.
I have the VBA written but do not know how to open, close and save the code view of the ####.html files. Please ... and thank you...
[email protected]This is actually the code view of file ####.html that I wish to find and replace programmatically where #### is a four digit number cataloguing each painting.... In 1995 I thought this was clever... maybe not so clever now :>)) Thank you for whatever you can do Rob!
!####.jpg!
h2. "Name####"
Oils on acrylic foundation commercial canvas - . xx X xx (inches) Started
Back of the Painting In Progress </p> </body> </html>
Warmest regards,
Phil the Forecaster, http://philtheforecaster.blogspot.ca/ and http://phils-market.blogspot.ca/ -
Excel 2010 Synchronize List with SharePoint List using VBA
I have used and loved the interaction between Excel and SharePoint for many generations of both solutions. It's a wonderful opportunity to integrate the familiarity and simplicity of Excel (formatting, ease of use, availability) with the data storage
and centralized list capabilities of SharePoint. Right?
When upgrading to Excel 2010, I have noticed with much dismay that much of the inherent easy to use features of previous versions were effectively stripped from this newest version. Much research, time and energy has been spent working around and resolving
the deficiency. One Microsoft based article,
http://support.microsoft.com/kb/930006, has provided the mechanics behind utilizing the "hidden" functionality... although, this capability to use VBA to create the synchronized list was available in previous versions. However, once Microsoft
published this article to this "hidden" functionality... I feel that the behavior should be supported by Microsoft in some way. OK?
Revised instructions to reproduce the problem:
1. Create a SharePoint list with 20 dummy records.
- Note the List Name ##LIST_NAME##
- Note the View GUID ##VIEW_GUID##
- Note SharePoint Base URL ##BASE_URL##
2. REVISED... In Excel 2010, save the file as Compatible "Excel 97-2003 Workbook". Close the file and reopen. Create a connected table (ListObject) in Excel using the article above to the SharePoint list. Use Sample VBA code
below:
Sub LinkedSharePointList()
ActiveSheet.ListObjects.Add SourceType:=xlSrcExternal,_
Source:=Array(##BASE_URL## & "/_vti_bin", ##LIST_NAME##, _
##VIEW_GUID##), LinkSource:=True, Destination:=Range("A1")
End Sub
3. OOPS REVISED this item. The problem is actually with ROW 21... So, update record on row 21... (no matter where the table is located... (if the "Destination" is "A1", then the problem is with ID=20, but if the Table is
shifted down to say A12, then ID=9 on row 21). Anyway... make a simple change to that record... and you'll see the ID immediately change.... as if it's a NEW record. WEIRD! Note: If the sheet is protected, then an error is displayed
indicating that a "read-only" record cannot be updated (referring to the ID cell in column A for the current row).
4. Now "synchronize" the list with excel. The former record is still in the list unchanged AND there is a NEW record in the list holding the changes. There are a number of problems that seem to ONLY occur when something changes to ROW
21.... Next, try to copy/paste multiple records across multiple rows that intersect with ROW 21. Yikes!!
I look forward to hearing others' experience!
Thanks!
MarkHere are some things that you can try (change the code, where appropriate):
Private Sub CreateList()
Dim folder As folder
Dim f As File
Dim fs As New FileSystemObject
Dim RowCtr As Integer
RowCtr = 1
Set folder = fs.GetFolder("http://excel-pc:43231/Shared Documents/Forms/") '<=Variable Location
For Each f In folder.Files
Cells(RowCtr, 1).Value = f.Name
RowCtr = RowCtr + 1
Next f
End Sub
Sub ListAllFile()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim pth As String
Dim WBn As Workbook
Dim ObCount As Long
Dim FileNme As String
Application.ScreenUpdating = False
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object associated with the directory
Set objFolder = objFSO.GetFolder("\\excel-pc:43231\Shared Documents\Forms\")
'** You'll need to specify your path here. By removing the http: from the path, the code liked it & found the folder. It wasn’t working previously ***
pth = "http://excel-pc:43231/Shared Documents/Forms/"
'** You'll need to specify your path here. The reason I’ve done this separately is because the path is not recognised otherwise when trying to specify it with workbook.open & using the value set for objFolder **
ObCount = objFolder.Files.Count
'** counts the number of files in the folder
'Loop through the Files collection
For Each objFile In objFolder.Files
Nm1 = Len("http://excel-pc:43231/Shared Documents/Forms/")
'** You'll need to specify your path here **
Nm2 = Len(objFile) - Nm1
FileNme = Right(objFile, Nm2)
'** I’ve done this part to find out/set the file name**
Set WBn = Workbooks.Open(pth & FileNme, , , , Password:="YourPassword")
'** opens the first file in the library – if there is no password, the remove everything from - , , , , Password:="Password1" – leaving the close bracket ‘)’
Application.ScreenUpdating = False
'** optional – you can leave the screen updating on
'<< Your coding here>>
'** The file is now open. Enter whatever code is specific to your spreadsheets.
Next
'** goes to next file within your sharepoint folder
End Sub
Sub SharePoint()
Dim xlFile As String, xlFullFile As String
Dim xlApp As Excel.Application
Dim wb As Workbook
xlFile = "\\excel-pc:43231\Shared Documents"
'http://excel-pc:43231/Shared Documents/
'****----denotes the path.(i.e) u give the path as windows search.Don't use "\" at the end.
'In the sharepoint path %20 denotes space.so u remove that and use space .
Set xlApp = New Excel.Application
xlApp.Visible = True
xlFullFile = GetFullFileName(xlFile, "Book") 'ANZ denotes starting characters of the file.
xlFile = xlFile & "\" & xlFullFile
Set wb = xlApp.Workbooks.Open(xlFile, , False)
'Once the workbook is opened u can do ur code here
wb.Close False
End Sub
Function GetFullFileName(strfilepath As String, _
strFileNamePartial As String) As String
Dim objFS As Variant
Dim objFolder As Variant
Dim objFile As Variant
Dim intLengthOfPartialName As Integer
Dim strfilenamefull As String
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFS.GetFolder(strfilepath)
'work out how long the partial file name is
intLengthOfPartialName = Len(strFileNamePartial)
For Each objFile In objFolder.Files 'Instead of specifying the starting characters of the file you can directly loop through all files in the folder .
'Test to see if the file matches the partial file name
If Left(objFile.Name, intLengthOfPartialName) = strFileNamePartial Then
'get the full file name
strfilenamefull = objFile.Name
Exit For
Else
End If
Next objFile
Set objFolder = Nothing
Set objFS = Nothing
'Return the full file name as the function's value
GetFullFileName = strfilenamefull
End Function
Sub SrchForFiles()
' Searches the selected folders and sub folders for files with the specified (xls) extension.
'ListTheFiles 'get the list of all the target XLS files on the SharePoint Directory
Dim i As Long, z As Long, Rw As Long, ii As Long
Dim ws As Worksheet, dd As Worksheet
Dim y As Variant
Dim fldr As String, fil As String, FPath As String
Dim LocName As String
Dim FString As String
Dim SummaryWB As Workbook
Dim SummaryWS As Worksheet
Dim Raw_WS As Worksheet
Dim LastRow As Long, FirstRow As Long, RowsOfData As Long
Dim UseData As Boolean
Dim FirstBlankRow As Long
'grab current location for later reference, for where to paste final data
Set SummaryWB = Application.ActiveWorkbook
Set SummaryWS = Application.ActiveWorkbook.ActiveSheet
y = "xls"
fldr = "\\excel-pc:43231\Shared%20Documents\Forms\AllItems.aspx"
FirstBlankRow = 2
'asd is a 1-D array of files returned
asd = ListFiles(fldr, True)
Set ws = Excel.ThisWorkbook.Worksheets(1) 'list of files
ws.Activate
ws.Range("A1:Z100").Select
Selection.Clear
On Error GoTo 0
For ii = LBound(asd) To UBound(asd)
Debug.Print Dir(asd(ii))
fil = asd(ii)
'open the file and grab the data
Application.Workbooks.Open (fil), False, True
'Get file path from file name
FPath = Left(fil, Len(fil) - Len(Split(fil, "\")(UBound(Split(fil, "\")))) - 1)
'Get file information
If Left$(fil, 1) = Left$(fldr, 1) Then
If CBool(Len(Dir(fil))) Then
z = z + 1
ws.Cells(z + 1, 1).Resize(, 6) = _
Array(Dir(fil), LocName, RowsOfData, Round((FileLen(fil) / 1000), 0), FileDateTime(fil), FPath)
DoEvents
With ws
.Hyperlinks.Add .Range("A" & CStr(z + 1)), fil
'.FoundFiles(i)
End With
End If
End If
'Workbooks.Close 'Fil
Application.CutCopyMode = False 'Clear Clipboard
Workbooks(Dir(fil)).Close SaveChanges:=False
Next ii
With ws
Rw = .Cells.Rows.Count
With .[A1:F1]
.Value = [{"Full Name","Location","Rows of Data","Kilobytes","Last Modified", "Path"}]
.Font.Underline = xlUnderlineStyleSingle
.EntireColumn.AutoFit
.HorizontalAlignment = xlCenter
End With
.[G1:IV1 ].EntireColumn.Hidden = True
On Error Resume Next
'Range(Cells(Rw, "A").End(3)(2), Cells(Rw, "A")).EntireRow.Hidden = True
Range(.[A2 ], Cells(Rw, "C")).Sort [A2 ], xlAscending, Header:=xlNo
End With
End Sub
Function ListFiles(ByVal Path As String, Optional ByVal NestedDirs As Boolean) _
As String()
Dim fso As New Scripting.FileSystemObject
Dim fld As Scripting.folder
Dim fileList As String
' get the starting folder
Set fld = fso.GetFolder(Path)
' let the private subroutine do all the work
fileList = ListFilesPriv(fld, NestedDirs)
' (the first element will be a null string unless the first ";" is removed)
fileList = Right(fileList, Len(fileList) - 1)
' convert to a string array
ListFiles = Split(fileList, ";")
End Function
' private procedure that returns a file list
' as a comma-delimited list of files
Function ListFilesPriv(ByVal fld As Scripting.folder, _
ByVal NestedDirs As Boolean) As String
Dim fil As Scripting.File
Dim subfld As Scripting.folder
' list all the files in this directory
For Each fil In fld.Files
'If UCase(Left(Dir(fil), 5)) = "MULTI" And fil.Type = "Microsoft Excel Worksheet" Then
If fil.Type = "Microsoft Excel Worksheet" Then
ListFilesPriv = ListFilesPriv & ";" & fil.Path
Debug.Print fil.Path
End If
Next
' if requested, search also subdirectories
If NestedDirs Then
For Each subfld In fld.SubFolders
ListFilesPriv = ListFilesPriv & ListFilesPriv(subfld, NestedDirs)
Next
End If
End Function
Finally . . .
Sub ListFiles()
Dim folder As Variant
Dim f As File
Dim fs As New FileSystemObject
Dim RowCtr As Integer
Dim FPath As String
Dim wb As Workbook
RowCtr = 1
FPath = "http://excel-pc:43231/Shared Documents"
For Each f In FPath
'Set folder = fs.GetFolder("C:\Users\Excel\Desktop\Ryan_Folder")
'For Each f In folder.Files
Cells(RowCtr, 1).Value = f.Name
RowCtr = RowCtr + 1
Next f
End Sub
Sub test()
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\Users\Excel\Desktop\Ryan_Folder")
'Set colSubfolders = objFolder.SubFolders
'For Each objSubfolder In colSubfolders
Cells(RowCtr, 1).Value = f.Name
RowCtr = RowCtr + 1
'Next
End Sub
Ryan Shuell -
How to use VBA in Excel to convert a pdf file to XML?
Hello,
I need to convert pdf to XML format so that it can be imported into Excel workbook and the information can be extracting out and mapped to existing excel cells. What is the easiest way to get it down without introduce any additional tools/software
other than Microsoft products? Client want to keep their process simple and it will be used for many agents in remote locations. They mentioned that they want to use VBA to do it. I could not find much useful information on this. Thanks a lot!
WeiNo Office programs can open a pdf and edit the contents so you will have to get a different app to convert teh pdf into xls format. There are plenty to be found on the web.
Rod Gill
The one and only Project VBA Book
Rod Gill Project Management
Maybe you are looking for
-
My partition menu in Disk Utility is greyed out in recovery partition
So upgraded to yosemite and after a while decided that i would do a clean install of it because it didn't update the recover partition and i could no longer boot into Ubuntu partition. So i made my bootable drive and booted into it. I was met with: W
-
Hello, Im trying to use RTMT to monitor Unity. When I click "Start Polling" i receive this error: Port Status query failed: ; nested exception is: java.lang.ClassCastException: org.apache.axis.attachments.AttachmentsImpl cannot be cast to org.ap
-
I recently bought a Palm Tungsten E2. I have been unable to install the Universal Wireless Keyboard software that came with the E2. Went online and downloaded the version 1.13 UWK and that would not install either. What did I do wrong? Post relates t
-
OSX 10.4 vs OSX 10.3.9 for InDesign CS
OSX10.4 vs OSX 10.3.9 I want to buy either a 20" 2.1 GHz G5 or the new 20" Intel machine. For the next several months I'll be inhabiting Photoshop and InDesign CS almost exclusively, with a bit of Safari and Toast here and there. Apple are offering a
-
HELP!!! FRUSTRATED-.Where did live people go??? I am trying to find out if here is a program for talented disabled users wanting to get CC at a steep discount. I cannot afford the current prices. Thank you.