Excel vba code help
hello guys,
I am new in writing vba codes. Each of the rows in range"N:Q" Should cut and pated in empty space of range "A:D"whenever it was being selected. My boss asked me define a key . So instead of cutting and pasting each row every time, just
by pushing one key ,it can get done.
N O P
Q
21-JUL-14 0.00 $ 61
$ 0.00
21-JUL-14 0.00 $42
$ 0.00
this data should get cut and paste as needed to available empty space in :
A B C D
21-JUL-14 0.00 $ 61
$ 0.00
Here is my code but it does not work :(
Sub MACRO1()
Sheets("OPERATING").Select
Range("A5:C5").Select
Selection.Copy
Sheets("OPERATING").Select
ActiveSheet.Paste
ANY HELP IS APPRECIATED!
Thanks
Hi,
You are selecting the target instead of the source. Try this:
Sub MACRO1()
Sheets("OPERATING").Select
Range("N5:Q5").Select
Selection.Copy
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
You don't have to select the range where the selection has to be copied to. Because the target range is the same as the source range selecting "A1" is sufficient. The last line disables the copy selection so it doesn't have the dotted line around
after it anymore when done pasting.
Maurice
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer. Thank You
Similar Messages
-
How to set task type of a task in MS Project using excel vba code.
Hello Gurus,
I am generating MS Project files(.mpp) files form excel data. An excel macro in the excel file will read the excel data and will generate the .mpp file. It is working fine. now i want to set the task type of all the tasks to "Fixed work" from excel
vba code.
How to use the property PjTaskFixedType in setting the task type??
refer below links
http://msdn.microsoft.com/en-us/library/office/ff861713.aspx
http://msdn.microsoft.com/en-us/library/office/ff864157.aspx
Can someone help me in setting task type property from excel vba.
I have attached my sample code used to generate the mpp file. It is not the complete code but you will get an idea from it.
Set pjApp = CreateObject("MSProject.Application")
pjApp.FileNew
Set newproj = pjApp.ActiveProject
newproj.Tasks.Add (task_name)
newproj.Tasks(mpp_row_number).Start = task_start_date
newproj.Tasks(mpp_row_number).Finish = task_end_date
newproj.Tasks(mpp_row_number).ResourceNames = resource_name
pjApp.FileSaveAs mpp_file_save_path & mpp_file_name & ".mpp"
pjApp.FileClose
pjApp.Quit
Any help is appreciated.Hi Syamku,
A simple example that sets the task type:
ActiveProject.Tasks(2).Type = pjFixedDuration
ActiveProject.Tasks(3).Type = pjFixedUnits
ActiveProject.Tasks(4).Type = pjFixedWork
http://msdn.microsoft.com/en-us/library/office/ff860469(v=office.15).aspx
Hope this helps -
Download Data From Excel - VBA Code to SAP Using BDC
Hi ,
I am Sudhir Dure, working with Satyam Computers.
I need help on the below query:
I have an excel file which download data from Excel to SAP using RFC function & with the help of VBA interface.
In this VBA code I have used BDC recording of SAP Transaction KE21N to post data into SAP.
Now I am facing problem to find sub screen (tab page screen ) in SAP from VBA code .
How to pass BDC Subscreen details from VBA code to SAP using below code?
BDCTABLE.Rows.Add
BDCTABLE.Cell(J, "PROGRAM") = PROGRAMNAME
BDCTABLE.Cell(J, "DYNPRO") = "0200"
BDCTABLE.Cell(J, "DYNBEGIN") = "X"
BDCTABLE.Cell(J, "FNAM") = "BDC_OKCODE"
BDCTABLE.Cell(J, "FVAL") = "=NEXT"
Thanks,
Sudhir Dure
9972097464can anyone tell me how to get the PurchaseOrder number and item quantity from the Salesorder...? what are the fields here as given below..??
For Each oItem In oSalesOrder.items
wsTemplate.Range(cols(3) & Indexv).Value = oItem.material.material
'wsTemplate.Range(cols(4) & Indexv).Value = ' I need item quantity here ????
wsTemplate.Range(cols(1) & Indexv).Value = sapSoNumber
wsTemplate.Range(cols(2) & Indexv).Value = ' I need purchase order number here>???
Indexv = (Indexv + 1)
Next
reply fast. please .. thanks -
BPC Excel VBA Code to change Current View ios broken, please help
Hi,
I inherited a macro set to cycle through a list of paramenters, change current view accordingly and print the reports. It was working fine in the prior version of BPC, but stopped when we transferred to BPC 7. The code stops when it's trying to make the Current View visible (in the prior version it was an option, in BPC 7 it's always visible). I also think it does not recognize the "OutlookSoft CPM CurrentView" name. I am not a VBA expert. Woudl appreciate any ideas. The place where the code stops is in bold below.
Thank you!
Sub cmdRun_Click()
Dim strColHead As String, strRowHead As String, strDataRange As String
Dim I As Integer, j As Integer, k As Integer
Dim blnOldStatusBar As Boolean, blnOSBarStartVis As Integer, intOSBarStartPosit As Integer
Dim strPL As String, strTabName As String
Dim intTotalPrintingPages As Integer, intPageCountStart As Integer
Dim dteStartTime As Date, dteEndTime As Date, intRunTimeSeconds As Integer, intRunTimeMinutes As Integer
'Record the start time
dteStartTime = Time
'Get the current status bar setting. Then, make sure the bar is visible
blnOldStatusBar = Application.DisplayStatusBar
Application.DisplayStatusBar = True
If Test_Ranges = False Then
Exit Sub
End If
strColHead = refColHeader.Value
strRowHead = refRowHeader.Value
strDataRange = refDataRange.Value
'Find and store the starting position for the OutlookSoft Currentview toolbar
'Then, make the entire OutlookSoft CurrentView toolbar visible
Application.StatusBar = "Storing CurrentView toolbar data"
blnOSBarStartVis = Application.CommandBars("OutlookSoft CPM CurrentView").Visible
Application.CommandBars("OutlookSoft CPM CurrentView").Visible = True
intOSBarStartPosit = Application.CommandBars("OutlookSoft CPM CurrentView").Position
Application.CommandBars("OutlookSoft CPM CurrentView").Position = 4
'Hide the form
frmParameters.Hide
'Cycle through the combinations of P&Ls and tab names
For I = 1 To Range(strRowHead).Rows.Count
'Change the currentview P&L
Application.StatusBar = "Changing the CurrentView..."
strPL = Range(strRowHead).Rows(I).Columns(1).Value
ChangeCurrentView "P_L", strPL
'Refresh and Expand
'Application.Calculation = xlCalculationManual 'temporarily turn off Excel's automatic calculation
Application.Run "MNU_eTOOLS_EXPAND"
'Application.Calculation = xlCalculationAutomatic 'turn the automatic calculation back on
Application.Run "MNU_eTOOLS_REFRESH"
Application.CalculateFullRebuild
'Get the total number of pages to be printed for the selected P&L
Application.StatusBar = "Counting pages to be printed for this P&L..."
intTotalPrintingPages = 0
For j = 1 To Range(strColHead).Columns.Count
If Range(strDataRange).Rows(I).Columns(j).Value = "x" Then
strTabName = Range(strColHead).Rows(1).Columns(j).Value
For Each pb In Sheets(strTabName).HPageBreaks
If pb.Extent = xlPageBreakPartial Then
intTotalPrintingPages = intTotalPrintingPages + 1 'add one sheet to the count for each page break
End If
Next
intTotalPrintingPages = intTotalPrintingPages + 1 'each sheet will print 1 more page than there are page breaks
End If
Next j
Application.StatusBar = intTotalPrintingPages & " total pages for " & strRowHead
'Cycle through each of the tabs (only if it is marked with an 'x')
intPageStartCount = 0
For j = 1 To Range(strColHead).Columns.Count
If Range(strDataRange).Rows(I).Columns(j).Value = "x" Then
strTabName = Range(strColHead).Rows(1).Columns(j).Value
'Set the footer
Application.StatusBar = "Building the page footer for " & strTabName & "..."
Sheets(strTabName).PageSetup.CenterFooter = " Page &P+" & intPageStartCount & " of " & intTotalPrintingPages
'Print the current sheet
Application.StatusBar = "Printing " & strTabName & " for " & strRowHead & "..."
Sheets(strTabName).PrintOut Copies:=1, Collate:=True
'Bump up the start value for page numbering
For Each pb In Sheets(strTabName).HPageBreaks
If pb.Extent = xlPageBreakPartial Then
intPageStartCount = intPageStartCount + 1 'add one sheet to the count for each page break
End If
Next
intPageStartCount = intPageStartCount + 1 'each sheet will print 1 more page than there are page breaks
End If
Next j
Next I
'Put the OutlookSoft CurrentView toolbar back to where the user had it.
Application.StatusBar = "Resetting the CurrentView toolbar"
Application.CommandBars("OutlookSoft CPM CurrentView").Position = intOSBarStartPosit
Application.CommandBars("OutlookSoft CPM CurrentView").Visible = blnOSBarStartVis
'Alert the user that the process is complete
Application.StatusBar = "Processing complete...notifing user"
dteEndTime = Time
intRunTimeSeconds = DateDiff("s", dteStartTime, dteEndTime)
intRunTimeMinutes = intRunTimeSeconds \ 60
If intRunTimeMinutes > 0 Then
intRunTimeSeconds = intRunTimeSeconds Mod (intRunTimeMinutes * 60)
End If
For k = 1 To 3
Beep
Next k
Application.DisplayStatusBar = blnOldStatusBar
MsgBox "The report generation process is complete." & Chr(10) & _
"Total retreival and printing time:" & Chr(10) & _
" Minutes: " & intRunTimeMinutes & Chr(10) & _
" Seconds: " & intRunTimeSeconds, vbOKOnly + vbInformation, "Process Complete"
End SubSub cmdRun_Click()
Dim strColHead As String, strRowHead As String, strDataRange As String
Dim I As Integer, j As Integer, k As Integer
Dim blnOldStatusBar As Boolean, blnOSBarStartVis As Integer, intOSBarStartPosit As Integer
Dim strPL As String, strTabName As String
Dim intTotalPrintingPages As Integer, intPageCountStart As Integer
Dim dteStartTime As Date, dteEndTime As Date, intRunTimeSeconds As Integer, intRunTimeMinutes As Integer 'Record the start time
For I = 1 To Range(strRowHead).Rows.Count 'Change the currentview P&L
Application.StatusBar = "Changing the CurrentView..."
strPL = Range(strRowHead).Rows(I).Columns(1).Value
ChangeCurrentView "P_L", strPL 'Refresh and Expand
'Application.Calculation = xlCalculationManual 'temporarily turn off Excel's automatic calculation
Application.Run "MNU_eTOOLS_EXPAND"
'Application.Calculation = xlCalculationAutomatic 'turn the automatic calculation back on
Application.Run "MNU_eTOOLS_REFRESH"
Application.CalculateFullRebuild 'Get the total number of pages to be printed for the selected P&L
Application.StatusBar = "Counting pages to be printed for this P&L..."
intTotalPrintingPages = 0
For j = 1 To Range(strColHead).Columns.Count
If Range(strDataRange).Rows(I).Columns(j).Value = "x" Then strTabName = Range(strColHead).Rows(1).Columns(j).Value
For Each pb In Sheets(strTabName).HPageBreaks
If pb.Extent = xlPageBreakPartial Then intTotalPrintingPages = intTotalPrintingPages + 1 'add one sheet to the count for each page break
End If
Next
intTotalPrintingPages = intTotalPrintingPages + 1 'each sheet will print 1 more page than there are page breaks
End If
Next j
Application.StatusBar = intTotalPrintingPages & " total pages for " & strRowHead 'Cycle through each of the tabs (only if it is marked with an 'x')
intPageStartCount = 0
-> Displays the line as programming code is not workin!
Edited by: Sam Patel on Aug 27, 2009 12:45 PM
Edited by: Sam Patel on Aug 27, 2009 12:45 PM
Edited by: Sam Patel on Aug 27, 2009 12:46 PM
Edited by: Sam Patel on Aug 27, 2009 12:47 PM
Edited by: Sam Patel on Aug 27, 2009 12:47 PM
Edited by: Sam Patel on Aug 27, 2009 12:49 PM
Edited by: Sam Patel on Aug 27, 2009 12:49 PM
Edited by: Sam Patel on Aug 27, 2009 12:50 PM -
Running Excel VBA code developed in Office 2010 under office 2013
I have developed a large application successfully under Excel 2010 and I have a 30 day trial of office 2013. My applications will not run. However if I take a piece of code from the application and open a new spreadsheet under 2013 and place it in a sub
and then run it ...works fine. So code that runs perfectly in an office 2010 environment will not run in the 2013 environment. I have changed the macro security settings to the most liberal and set the "trust VBA object model" option...still won't
work. I know its not the code because I can insert it in a new sheet and run it. PLEASE HELPHello Roderick,
It is not clear whether the code is working or not...+
> However if I take a piece of code from the application and open a new spreadsheet under 2013 and place it in a sub and then run it ...works fine. So code that runs perfectly in an office 2010 environment will not run in the 2013 environment.
I see the following statements:
> and then run it ...works fine
and then you wrote the opposite:
> will not run in the 2013 environment
Can you run the code under the debugger? Does it work in Office 2013?
It looks like some of your event handlers are not fired. Am I right? -
Error Handling when excel vba code does not find the file
Hi Below is my code:
file1 = Dir("Q:\Budget\Historical Budgets\" & new_dept_folder & "\*.xls*")
col = 2
col_new = 3
Application.DisplayAlerts = False
While (file1 <> "")
filename = Left$(file1, 6)
' Open the newly selected workbook
Set wb = Workbooks.Open("Q:\Budget\Historical Budgets\" & new_dept_folder & "\" & file1)
udds = filename & " - " & wb.Sheets("Budget").Range("J1").Value
ThisWorkbook.Sheets(1).Cells(1, col).Value = udds
For x = LBound(data_new) To UBound(data_new)
wb.Sheets("Budget").Select
Range(data_new(x)).Select
Selection.Copy
ThisWorkbook.Sheets(1).Cells(x + 5, col_new).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Next x
' Close the current workbook
wb.Close SaveChanges:=False
On Error GoTo Errhandler
Set wb_old = Workbooks.Open("Q:\Budget\Historical Budgets\" & old_dept_folder & "\" & file1)
<--- Need Error handling on this line (i.e. if I get error here)
For x = LBound(data) To UBound(data)
wb_old.Sheets("Budget").Select
Range(data(x)).Select
Selection.Copy
ThisWorkbook.Sheets(1).Cells(x + 5, col).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Next x
Application.CutCopyMode = False
' Close the current workbook
On Error Resume Next
wb_old.Close SaveChanges:=False
Errhandler:
For x = LBound(data) To UBound(data)
ThisWorkbook.Sheets(1).Cells(x + 5, col).Value = 0
Next x
' Select the next file in the dir array
file1 = Dir
col = col + 5
col_new = col_new + 5
Wend
Everytime I run the code the errhandler which I don't need. Could you please help me on this.
Regards, HiteshHi,
You could check whether the file is exist, then open it.
If Dir(path)<>”” Then
There are three On Error Statements, On Error GoTo <line>, On Error Resume Next and On Error GoTo 0.
More information, please refer to:
# How to Use "On Error" to Handle Errors in a Macro
https://support.microsoft.com/en-us/kb/141571?wa=wsignin1.0
Regards
Starain
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. -
Copying Graphs and Pie Charts generated in Analysis View to Email item using Excel VBA Macro Code
Hi
I am currently working on an exce VBA macro code that would help me take snapshots of the Graphs and Pie charts generated in QC for a particular application and copy the same to an email item using excel VBA macro code.
I was able to write the code to create an email item. But I have no clue of how i can take snapshot of the graphs in Analysis View using excel VBA
Any help would be highly appreciated.
Thanks in Advance
Regards
Amituseramit,
You are in the consumer end products forum. You will also want to ask your question over at the Enterprise Business Community.
Click the plus sign (+) next to Discussion Boards to drop down all the options for servers, networking and any other professionally related problems.
http://h30499.www3.hp.com/ -
How to get Data from SAP B1 through Journal Entries objects (Excel VBA)
Hi Genius
i had try to login SAB B1 thorugh MS Excel VBA code and it worked well. but i need some questions regards getting the data from after login. that means i want the Posting date, Transaction No, account code, debit and credit amount from Journal entries posted in a particular day through MS excel VBA into excel sheets 1 cell A1:E1
how i get it if any possible ways to do that
here my code to login
Public Sub login()
Sheets("Login").Select 'access the login tab
Worksheets("Login").Range("B1").Activate 'put focus on cell B1 (manager)
B1UserID = Trim(ActiveCell.Value2) 'set Businsss One user
ActiveCell.Offset(1, 0).Activate
B1Password = Trim(ActiveCell.Value2) 'set Business One password
ActiveCell.Offset(1, 0).Activate
sqluser = Trim(ActiveCell.Value2) 'set SQL user
ActiveCell.Offset(1, 0).Activate
sqlpass = Trim(ActiveCell.Value2) 'set SQL password
ActiveCell.Offset(1, 0).Activate
Db = Trim(ActiveCell.Value2) 'set Database name
ActiveCell.Offset(1, 0).Activate
Server = Trim(ActiveCell.Value2) 'set Server name
Set company1 = New SAPbobsCOM.Company 'initialate DI company object
company1.DbServerType = dst_MSSQL2005
company1.Server = Server
company1.DbUserName = sqluser
company1.DbPassword = sqlpass
company1.CompanyDB = Db
company1.UserName = B1UserID
company1.Password = B1Password
'connect to the database
lRetCode = company1.Connect
If lRetCode <> 0 Then
sErrMsg = company1.GetLastErrorDescription
MsgBox (sErrMsg)
Else
MsgBox ("Connected to: " & company1.CompanyName)
End If
End Sub
pls help me
advance thanks to solversGordons way is the easiest - just query the OJDT table for journal entry headers and JDT1 for journal entry lines if needed.
But if you want to work with the business objects:
'Journal entry
Dim oJE As SAPbobsCOM.JournalEntries
Set oJE = company1.GetBusinessObject(oJournalEntries)
oJE.GetByKey(1234)
Dim postingDate as String
postingDate = oJE.DueDate
'etc etc -
Hello,
Hope someone call help with the following.
I am trying to retrieve data from a table within SAP by using the following Excel VBA code.
Sub retrieve_table_contents()
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
iStartRow = 4
Worksheets(1).Select
Cells.Clear
'Create Server object and Setup the connection
Set R3 = CreateObject("SAP.Functions")
R3.Connection.System = "QA2"
R3.Connection.client = "900"
R3.Connection.user = "mbrough"
R3.Connection.password = "st34lh"
R3.Connection.language = "EN"
If R3.Connection.logon(1, False) <> True Then
Exit Sub
End If
'Call RFC function TABLE_ENTRIES_GET_VIA_RFC
Set MyFunc = R3.Add("TABLE_ENTRIES_GET_VIA_RFC")
Dim oParam1 As Object
Dim oParam2 As Object
Dim oParam3 As Object
Dim oParam4 As Object
Set oParam1 = MyFunc.exports("LANGU")
Set oParam2 = MyFunc.exports("ONLY")
Set oParam3 = MyFunc.exports("TABNAME")
Set oParam4 = MyFunc.Tables("SEL_TAB")
oParam1.Value = "E"
oParam2.Value = ""
oParam3.Value = "LAGP"
If frmQuery.txtSelect <> "" Then
oParam4.Rows.Add
oParam4.Value(1, "ZEILE") = frmQuery.txtSelect
End If
Result = MyFunc.CALL
If Result = True Then
Set NAMETAB = MyFunc.Tables("NAMETAB")
Set SEL_TAB = MyFunc.Tables("SEL_TAB")
Set TABENTRY = MyFunc.Tables("TABENTRY")
Else
MsgBox MyFunc.EXCEPTION
R3.Connection.LOGOFF
Exit Sub
End If
Result = R3.TABLE_ENTRIES_GET_VIA_RFC(EXCEPTION, LANGU:="E", ONLY:="", TABNAME:="LAGP", SEL_TAB:=SEL_TAB, NAMETAB:=NAMETAB, TABENTRY:=TABENTRY)
'Quit the SAP Application
R3.Connection.LOGOFF
If Result <> True Then
MsgBox (EXCEPTION)
Exit Sub
End If
'Display table header
iColumn = 1
For Each ROW In NAMETAB.Rows
Cells(iStartRow - 1, iColumn) = ROW("FIELDNAME")
' For C and N datatypes, explicitly set the cell to TEXT format, otherwise leading zeroes will be lost
' when numbers are imported from a SAP text field
If ROW("INTTYPE") = "C" Or ROW("INTTYPE") = "N" Then
Range(Cells(iStartRow - 1, iColumn), Cells(iStartRow - 1 + TABENTRY.Rowcount, iColumn)).Select
Selection.NumberFormat = "@"
End If
Cells(iStartRow, iColumn) = ROW("FIELDTEXT")
iColumn = iColumn + 1
Next
Range(Cells(iStartRow - 1, 1), Cells(iStartRow, NAMETAB.Rowcount)).Font.Bold = True
'Display Contents of the table
iColumn = 1
For iRow = iStartRow + 1 To TABENTRY.Rowcount
For iColumn = 1 To NAMETAB.Rowcount
iStart = NAMETAB(iColumn, "OFFSET") + 1
' If this is the last column, calculate the length differently than the other columns
If iColumn = NAMETAB.Rowcount Then
iLength = Len(TABENTRY(iRow, "ENTRY")) - iStart
Else
iLength = NAMETAB(iColumn + 1, "OFFSET") - NAMETAB(iColumn, "OFFSET")
End If
' If the fields at the end of the record are blank, then explicitly set the value
If iStart > Len(TABENTRY(iRow, "ENTRY")) Then
Cells(iRow, iColumn) = Null
Else
Cells(iRow, iColumn) = Mid(TABENTRY(iRow, "ENTRY"), iStart, iLength)
End If
Next
Next
'Format the Columns
Range(Cells(iStartRow, 1), Cells(iStartRow + TABENTRY.Rowcount, NAMETAB.Rowcount)).Select
Selection.EntireColumn.AutoFit
End Sub
However when I run the code I get the following exception message. 'SYSTEM_FAILURE' and nothing is returned.
Does anyone know why this is?
Thanks,
MikeYou can send data from excel to the MII message listener with a simple http post.
Message format requirments can be found here:
[http://help.sap.com/saphelp_xmii120/helpdata/en/45/6a86ac88130dece10000000a11466f/content.htm|http://help.sap.com/saphelp_xmii120/helpdata/en/45/6a86ac88130dece10000000a11466f/content.htm]
Edited by: Christian Libich on Aug 10, 2009 10:14 PM -
Hello guys,
I need to send keys to a window in the background, but I don't want it to pop up when I do it as it may cause some errors if I'm typing something at that moment. Is this possible?
The script I'm working on converts a spool to a pdf, but when the save as window comes up, the script stops recording because that is not a SAP screen, but a windows screen.
I was actually able to make it work by ending the script right before executing the transaction, then I used AppActivate and SendKeys to execute the transaction by pressing F8 and saving the file by pressing enter, but I still have these windows popping up while the macro is running, so, is it possible to have the SendKeys point to a specific application without it bringing it to the foreground?
Also, please note that I am new to programming, so I'm not familiar with all the functions.
Thanks in advance.Hello Jahir.
I had several similar request in past.
One requirement was mass convertion of PM orders printout from spool to PDF.
I found a solution where a small ABAP-Report (implemented in coding-area of an SQ02 infoset) Transfer spool data from my SAP user as PDF to a temp Folder on my local HDD.
Then I convert this PDF-files with an small application (pdf2txt.exe) to text-files. Where a small Excel VBA code got an specific text as identifier (PM order number).
So I have pdf-files with spoolnumber-naming and dedicated PM order number. So a small VBA code is renaming my files for better identification by enduser.
Another method was to write an small VBA macro which is able to identify Save-As dialogbox and fillin a specific filename and press 'Save' by using ESER32-API methods and functions.
As you are new with programming I guess both methods are a Little bit to complex for you.
LEt me know when you Need more Information for one of above used methods by me.
MAy you can give some more Details in which Transaction you will Trigger the spools.
Br, Holger -
Acrobat 9.0 Standard. Setting PDF file password from Excel VBA
Acrobat 9.0 Standard. Setting PDF file password from Excel VBA
Hi: I am trying to find a call to set the password of a PDF file that I am creating from Excel Workbook using a VBA call.
I basically have this Excel VBA code that works fine and creates a file.
pBook.PrintOut Copies:=1, preview:=False, ActivePrinter:="Adobe PDF", _
PrintToFile:=True, collate:=True, PrToFileName:=PSFileName
' Convert the postscript file to .pdf
Dim myPDF As PdfDistiller
Set myPDF = New PdfDistiller
myPDF.FileToPDF PSFileName, "", ""
BUT, I need to set the password on this PDF file and do not see an option to do so.
Can you provide a solution for this situation? Appreciate your response in advance.
Thanks.There is no way to set password programmatically using any other dll or any other kit?
I am creating a bunch of PDF files for users programmatically but then they have to go in and set password themselves? This is very inconvenient for users. -
Extract image in PDF file - vba code in Excel
Hi All,
I am applying a solution for my company. We have some Front offices which receive customers' requests in paper form.
We have one Back Office which is receiving the customers' original paper requests from Front Office via courier mail.
To improve the efficency, I am trying to apply a solution which allow the Front Offices to scan the paper requests into PDF files.
Those scanned files will be accessed by Back Office to process.
Given the volume of the requests, it is impossible to open each file in the folder by clicking mouse.
I have completed the tool (using Excel and vba ) which displays all of the requests (PDF files) as hyperlinks in Excel list.
The requests are ranked with priority so that the Back Office people know which to process first.
That solution works well.
However, Back Office has just requested me to display certain fields in the PDF files as image in Excel's cells so that they can type the information to the system without having to open the PDF files. The way that the images are displayed on Excel cells is an extraction of part of PDF page.
I know that in Adobe Reader, I can use my mouse to select part of the area then copy to clipboard, so I hope that we can do the extraction programmatically.
Could anyone can help me figure out how to implement above extraction solution in Excel vba?
I am facing 2 concerns:
1. Acrobat SDK:
I don't know if my company purchased license of Acrobat SDK or not. But when I open Excel VB editor, I can see in "Reference" menu the below items:
+ Adobe Acrobat Browser Control Type Library 1.0
+ Adobe Acrobat 9.0 Type Library
+ Acrobat Access 3.0 Type Library
Are the above enough for my application?
2. VBA code for extraction of part of PDF files:
- What should be on the vba code for the extraction? Which functions I should use?
Thank you very much
CheersThe functionality that you require is not available to VBA/COM - it is only exposed via C/C++.
However, you could retrieve the ENTIRE page image to the clipboard and then use whatever VB/VBA methods you choose to grab a section of the image.
Of course, this all assumes that Adobe Acrobat is installed on each person's computer that will be using the solution since Reader does not have the necessary APIs and Acrobat can't be installed on a server. -
How to get active user data using vba code in excel
Start with this script: http://community.spiceworks.com/scripts/show/1572-list-user-info-in-excel
Then add an extra line to get the msDS-UserAccountDisabled attribute, or test for it in an If/Else block.Could you please help me to get only active user details from active directory using vba code.
Any help would be immensely appreciated.
Thanks in advance
This topic first appeared in the Spiceworks Community -
VBA code to connect Essbase from Excel
Hi All,
I need VBA code to connect & retrive the data from Essbase trough Excel sheet ....Please advise...
Regards,
PrabhasKVC wrote:
As gleen advised install essbase excel addin before going to use below script
create push button to trigger below script
press Alt F11create module copy the below module and ur done
Sub main()
X = EssVConnect("[Book1.xls]Sheet1", "admin", "password", "EssbaseServerName", "Sample", "Basic")
‘Replace all the above parameters according to you environment.
'("[Book1.xls]Sheet1" > Excel filename where this code is written followed by the sheetname
'admin > username who has access to this application/database
'EssbaseServerName > essbase analytic server name
'Sample > application name
'Basic > database name
If X = 0 Then
MsgBox ("Essbase connect is successful.")
Else
MsgBox ("Essbase connection failed.")
End If
X = EssVRetrieve("[Book1.xls]Sheet1", range("A1:F12"), 1)
If X = 0 Then
MsgBox ("Essbase retrieve is successful.")
Else
MsgBox ("Essbase retrieval failed.")
End If
for Disconnect
X = EssVDisconnect(Empty)
If X = 0 Then
MsgBox ("Essbase disconnect is successful.")
Else
MsgBox ("Essbase disconnect failed.")
End If
End SubKVC ...Thanks for your Help... -
Microsoft Excel Has Stopped Working at End of VBA Code
I'm using Microsoft Excel Professional Plus 2010. My code essentially looks up a date in a different sheet, copies it to another sheet in an organized location, and prints to PDF. If I run the code for a period longer than a couple months ago,
at the end of the VBA code, it states "Microsoft Excel Has Stopped Working", quits, and recovers.
I added in a piece of code at the end to save the workbook, which it does, then it quits. I can reopen the document and all my work is saved. There is something going on I can't put my finger on but for some reason it only happens when I'm dealing
with more information than usual (a couple months worth, possibly only 20-30 rows of info).
Any suggestions? Thank you in advance!
DanHi,
In regarding of the issue, we'd better do some tests to narrow down the issue and find the root cause.
Please copy the file with code to another PC (We'd better use the similar environment) to test.
First, if it works well, this issue might be caused by the Excel or other program in your PC. I recommend we follow this KB to troubleshoot:
http://support.microsoft.com/kb/2758592/en-us
Then, if the issue still exists, we could collect the Event log and App crash dump file to do deep troubleshoot.
Second, if it still crashes Excel 2010 in other PC, it might be due to the VBA code. I suggest you upload the code and post the issue to MSND forum for Excel to get more help.
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.
Regards,
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.
Maybe you are looking for
-
F.05 foreign currency revaluation
Hi All, Please any body suggest me how the foreign currency revaluation works. Once we run F.05 transaction means what it will do and which items it will pick and where it will post, and what is the realised gain and unrealised gain vice versa loss.
-
We are using Labview to create a exe file. However when a user reopens the exe all the user settings in the labview exe are lost. These settings are mostly switches either turned on or off. I would like to find a way so that once the switches are set
-
How to convert script o/p to pdf o/p
Hi All, I have a requirement where i need to convert script output to pdf output. What is the function moodule available ? Please help me in this regard asap. Regards Lakshmi
-
On Mac notebook unable to connect to App store from icon or IPhoto
Cannot connect to App store from iPhoto or icon on toolbar. Any suggestions. Also, cannot sign-in to Mobile me. Password updated on iCloud. Old and new PW do not work??
-
Pre Order at Full Retail Price?
So I am not eligible for a 2 year upgrade, but am interested in purchasing the Iphone 4 at full retail price. Does anyone know if existing vzw customers can PRE ORDER the Iphone 4 on February 3rd at full retail price. I have been getting mixed answer