I am working on a standard "book 1, sheet1" workbook, will rename when I am done.
I have a master workbook, the sheet in this workbook will have information typed up by the user. The information is 3 parts: a user ID, location of a picture, save location.
this is the current codes i have that are working.
Sub Export_To_PDF()
Dim WBName, filepath, Filepth As String
WBName = ActiveWorkbook.Name
Filepth = Workbooks("Book1.xlsx").Sheets("Sheet1").Range("B4").Value
filepath = Filepth & "\" & WBName & ".pdf"
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=filepath, _
Quality:=xlQualityMinimum, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
End Sub
Sub Macro1()
Sheets("Balancing Summary").Select
Range("E24").Select
ActiveCell.FormulaR1C1 = "A1111"
Range("E26").Select
ActiveSheet.Pictures.Insert("C:\Users\a1111\Music\ThePicture.jpg").Select
ChDir "C:\Users\a1111\Documents\Done"
Call Export_To_PDF
End Sub
Sub DoAll()
Workbooks("Book1.xlsx").Activate
Dim wbkX As Workbook
For Each wbkX In Application.Workbooks
wbkX.Activate
Call Macro1
Next wbkX
End Sub
The code takes the address typed in Cell B4 and saves the document there. i need the same to be done for the picture. the address for the picture will be typed in Book1, Sheet 1, B3. i need the below line to not have the address but refer to the specific cell in that book and sheet when the macro is run.
ActiveSheet.Pictures.Insert("C:\Users\a1111\Music\ThePicture.jpg").Select
there will be multiple workbooks and sheets open, so it has to specify the correct workbook and sheet.
i need it done similarly to the below line
Filepth = Workbooks("Book1.xlsx").Sheets("Sheet1").Range("B4").Value