Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I want to save many pdfs but the process of saving via ExportAsFixedFomat takes very long
Do you guys have some idea how to improve my Code (other functions,...)
Code
WordDoc.ExportAsFixedFormat OutputFileName:=wholeString, ExportFormat:=wdExportFormatPDF
Tough to figure out the exact reason in your case. But you can try to deactivate the screen updating like so:
..
Application.ScreenUpdating = False
WordDoc.ExportAsFixedFormat OutputFileName:=wholeString, ExportFormat:=wdExportFormatPDF
Application.ScreenUpdating = True
..
Excel recalculates the workbook before each PDF is generated. Why this should be the case is not immediately obvious. The solution was to insert the following line of code at the beginning of the routine and turn it back to automatic at the end:
Application.Calculation = xlManual
This reduces the total time.
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I'm working through an Excel VBA macro that iterates through a sheet and puts dynamic formulas in certain cells. The formula stays the same, but it needs to reference an external workbook that will change often.
At the beginning of my sub, I ask for user input where the user selects the file. I open that file and then start using it. This works perfectly fine, but I cannot figure out how to properly reference that workbook in a formula.
My code, trimmed down to just the lines in question:
MsgBox ("Select the PO items workbook sheet with key in column A.")
POI_inputfile = Application.GetOpenFilename
Set po_items = Workbooks.Open(POI_inputfile, False)
Do Until i = bottom_cell
'lookup of MC against PO line item
wb_out.Worksheets("Sheet1").Range("c2").Offset(i).Formula = "=VLOOKUP(H" & i + 2 & "&I" & i + 2 & ",'[" & poi_importfile & "]Export'!$A:$E,5,FALSE)"
i = i + 1
Loop
I think the issue is how I'm handling this formula and passing in the workbook, but I'm not sure what I'm doing wrong.
Help appreciated!
Just to mark this as closed - both comments on my original question were correct but A.S.H was correct in that I should be using the .Name property.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
The point of this is that I have a column of cells in which I'd like to put a comment in each cell (which I move up and down with sort). However I'm a bit too lazy to go through hundreds of cells and each time having to delete the username when I insert a blank comment for future use. So I thought it'd be easier, if I could select a cell and just press a shortcut key instead.
Activecell.AddComment ("test") or Activecell.AddComment ("")
Excel VBA has decent online help
With Worksheets(1).Range("e6").AddComment
.Visible = False
.Text ""
End With
Assign a shortcut key to this macro:
Sub BlankComments()
Dim r As Range
For Each r In Selection
r.ClearComments
r.AddComment Text:=""
Next r
End Sub
Select some cells and run the macro.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Goal: get phone numbers in Google trough a table of companies data in Excel
Table: Accounts
Name|Industry|State|City
Hit Combination of Cells and "landline phone" on Google Search and collect in Excel
I'm making this manually. Would love to make it happen trough programing.
Tips and reference coding would help a lot.
Say you have a set of topics on which you wish to do a google search. Place the topics in column A:
The following macro:
Sub dural()
Dim N As Long, i As Long
N = Cells(Rows.Count, "A").End(xlUp).Row
With ActiveWorkbook
For i = 1 To N
.FollowHyperlink Address:="https://www.google.com/search?q=" & Cells(i, 1).Value
Next i
End With
End Sub
will open a set of Google search windows. All you need to do is add to the code to:
select the appropriate link
gather data from the web pages.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have around 500 files of excel and the most part have filter. Now i need to put all information in one sheet. I found how to put all in one sheet but the books with filter only copy information with filter and i need all.
So, i need to remove filter of all excel files. Important (not all files have filter)
Thanks for your help ;)
Before you copy the data, you should use:
If ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If
This will turn off the filter.
Will remove any filter on all opened workbooks, have fun :)
sub try_this()
dim wb as workbook
dim sh as worksheet
for each wb in workbooks
for each sh in wb.worksheets
sh.AutoFilterMode = False
next
next
end sub
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I want to create a Save as... button in an UserForm.
When I click it, a dialog appears to save the print area range of activesheet as a *.pdf file.
Here is how to export in PDF the print area of the active sheet :
Dim Ws As Worksheet
Set Ws = ThisWorkbook.ActiveSheet
ws.Range(ws.PageSetup.PrintArea).ExportAsFixedFormat _
Type:=xlTypePDF _
FileName:="sales.pdf" _
Quality:=xlQualityStandard _
DisplayFileAfterPublish:=False
You just need to change "sales.pdf" to fit your purpose! ;)